Script to update PST File locationsBookmark:Question
:
We are running a project to migrate the backend file location for 1000 user created PST files to a new 2008 File server. The server will not re-use the previous server name and we will not be able to use a DNS alias for the old server to point to the new one.
Users have historically used personal folders stored in their networked homedrives (Yes, we know it is not a Microsoft best practise methodology for PST file usage) and we are planning to move all pst files to a decidated PST file server and then update the path location to the pst files with no user impact or intervention.
I am looking at implementing a logon script to remap the pst file to the new location. The workflow will be as follows
Nighttime (After backups complete) robocopy pst files from \\oldserver\homedrive$ to \\newserver\pstdir$
Remove permissions to the source PST file
On user logon - map new network drive (P:\ to the \\newserver\pstdir$ directory (this will be a security locked down folder based on the user's name)
Logon script to query the registry or mapi profile of the user and for every pst file connected (Some users have more than 1) change the path from M:\ (current user homedrive mapping) to P:\ (preserving the rest of the path, for example if a user had M:\MyMail\October-Archive.
pst file then the remap should be P:\MyMail\October-Archive.
pst)
I am ok for the 1st parts of the problem, but I am stuck on the Logon script, as the value stored in the registry is a hexidecimal string. So I need to query all outlook profiles for the user, compile an array of pst file string locations, decode the strings, rewrite the new path, encode the string and write it back.
I have found a few scripts on the net that in part achieve some aspects of this, but nothing that provides a complete solution.
Mapi profile information is stored in the registry here "HKCU\Software\Microsoft\W
indows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
The key name for a PST file is either "01020fff" "001f6700" (Example below)
HKEY_CURRENT_USER\Software
\Microsoft
\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Default
Outlook Profile\93abdcf58c80884b92
c1b8c1b272
dc12
01023414 REG_BINARY 4E495441F9BFB80100AA0037D9
6E0000
001f300a REG_BINARY 6D0073007000730074002E0064
006C006C00
0000
001f3d13 REG_BINARY 7B003600340038003500440032
0036003200
2D00430032
0041004300
2D00310031
0044003100
2D00410044
0033004500
2D00310030
0041003000
4300390031
0031004300
3900430030
007D000000
00033e03 REG_BINARY 21000000
00033009 REG_BINARY 00000000
001f3001 REG_BINARY 50006500720073006F006E0061
006C002000
46006F006C
0064006500
7200730000
00
001f3006 REG_BINARY 50006500720073006F006E0061
006C002000
46006F006C
0064006500
7200730000
00
01023d0c REG_BINARY 2BDB2EC4365E81428904AB3D06
E7FD3E
001f3d09 REG_BINARY 4D005300550050005300540020
004D005300
0000
00036770 REG_BINARY 00000080
00036702 REG_BINARY 00000010
01020fff REG_BINARY 0000000038A1BB1005E5101AA1
BB08002B2A
56C200006D
737073742E
646C6C0000
0000004E49
5441F9BFB8
0100AA0037
D96E000000
0043003A00
5C00540065
006D007000
5C00540065
0073007400
31002E0070
0073007400
0000
001f6700 REG_BINARY 43003A005C00540065006D0070
005C005400
6500730074
0031002E00
7000730074
000000
001f3004 REG_BINARY 0000
01020ff9 REG_BINARY 636E08EC45E2F449AB50A4F2AB
97DDF3