Solved

how to change PST location in outlook profile automatically

Posted on 2014-09-16
8
40 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

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

Utilizing an array to gracefully append to a list of EmailAddresses
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

920 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

13 Experts available now in Live!

Get 1:1 Help Now