Solved

how to change PST location in outlook profile automatically

Posted on 2014-09-16
8
39 Views
Last Modified: 2016-01-03
Hi Experts,

now we have some clients with outlook and they use PST files connected to a share.
This share will be changed now.
But I wont to do this for each user and outlook profile.
Is it possible to do it with script or automatically ?
0
Comment
Question by:Eprs_Admin
  • 3
  • 2
8 Comments
 
LVL 20

Expert Comment

by:netcmh
ID: 40325619
0
 

Author Comment

by:Eprs_Admin
ID: 40341091
This script is very complicated.
Do you have something easier ?
0
 
LVL 20

Expert Comment

by:netcmh
ID: 40341594
That code is in C++. You just need to compile it and run it as:
UpdatePSTPath c:\old\path c:\new\path
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:Eprs_Admin
ID: 40376501
ok I will check it...
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40402158
Here is a PowerShell script I wrote (based on VBS code found at  http://community.spiceworks.com/scripts/show/2320-update-pst-path-registry).
You need to run that e.g. as login script, as it runs only for the current user.
The locations used should be obvious ;-).
Currently the script is in test mode - no moving of PST files, and the reg key changed is a copy only. See notes in the code for changes to do the real stuff.
cls
# *** change this to your destination root
$oldLocation = "\\oldserver\pstshare\$env:UserName\"
$newLocation = "\\newserver\pstshare\$env:UserName\"
dir -Recurse 'HKCU:Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook' |
  ? { $_.Property -contains "001f6700" } |
  % {
    get-itemproperty $_.PsPath "001f6700"
  } |
  % {
    $bytes = $_."001f6700"
    $curpath = (-join [Char[]] $(foreach ($i in 1..($bytes.Count-1)) { if ($i % 2) { $bytes[$i]*256 + $bytes[$i-1] } })).Trim(0)
    if ($curpath -like "$oldLocation*") {
      Write-Host "Old server path found in $($_.PsPath.Replace($_.PsProvider.ToString()+'::','')): $curpath"
      Move-Item $curpath $newLocation -whatif   # *** Remove -whatif if certain
      if ($?) {
        $newpath = Join-Path $newLocation (split-path -Leaf $curpath)
        # *** replace "001f6700 test" with "001f6700" if certain
        Set-ItemProperty $_.PsPath "001f6700 test" -value ([Byte[]]($(foreach ($i in ([byte[]] [Char[]] $newpath)) { $i, 0 })+@(0,0)))
      }
    }
  }

Open in new window

0
 

Author Comment

by:Eprs_Admin
ID: 40412816
ok I will check it...
0

Featured Post

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now