Solved

how to change PST location in outlook profile automatically

Posted on 2014-09-16
8
41 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Read this checklist to learn more about the 15 things you should never include in an email signature.
This video discusses moving either the default database or any database to a new volume.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

810 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