none
move pst files and remap them RRS feed

  • Question

  • Hi all

    We are moving to a new platform with our messaging infrastructure and need all .pst's moved to the server from the local workstation. We are about 4000 users in 5 different sites. Is there a powershell script I can use that will automatically do the following for me:

    1) Find all the pst's on the workstatsions and move (not copy)  them to the servers

    2)Remap them once they are in the new location eg. \\servername\pstshare\%username%

    can this be done with Powershell? the pst environment is a pain and we now need to get a tool to do this work as manually it seems HUGE

    Thanks in advance

    Tuesday, September 11, 2012 11:59 AM

Answers

  • Sure, you can leave out the 3rd and 5th line altogether, as below:

    $sourcePath = $env:userprofile
    $targetPath = '\\servername\pstshare\' + $env:username
    dir *.pst -Path "$sourcePath" -Recurse -ErrorAction SilentlyContinue | % ( $_.fullname ) { mv $_.fullname -Destination $targetPath }


    • Proposed as answer by Nigel Finn Friday, September 14, 2012 3:18 PM
    • Marked as answer by Yan Li_Moderator Monday, September 17, 2012 1:42 AM
    Wednesday, September 12, 2012 1:06 PM

All replies

  • Your first requirement is a very difficult one.  As you don't know the names of the users, and the .pst files are buried deep inside the user's profile, it would be hard to search for all .pst's, and associate each one with a user.

    Grant Ward, a.k.a. Bigteddy

    Tuesday, September 11, 2012 1:39 PM
  • I knocked this up for you - let me know if it doesn't work

    $sourcePath = $env:userprofile
    $targetPath = '\\servername\pstshare\' + $env:username
    $driveMappingLetter = 'N:'
    dir *.pst -Path "$sourcePath" -Recurse -ErrorAction SilentlyContinue | % ( $_.fullname ) { mv $_.fullname -Destination $targetPath }
    net use /persistent:yes $driveMappingLetter $targetPath
    Addendum: As per Bigteddy's notes, this requires the user to be logged on. As such, it will need to be part of the user login script.
    • Edited by Nigel Finn Tuesday, September 11, 2012 9:50 PM
    Tuesday, September 11, 2012 4:12 PM
  • That will only work run locally for the logged-on user.

    Grant Ward, a.k.a. Bigteddy

    Tuesday, September 11, 2012 4:21 PM
  • Good point. I did forget to mention that this will need to be run as a login script.

    CraMey, if you have more specific details about how you want to conduct the migration, that would help us to work something out for you.

    Tuesday, September 11, 2012 9:45 PM
  • Do you want to place the pst files in the network share? This is very bad practice http://blogs.technet.com/b/askperf/archive/2007/01/21/network-stored-pst-files-don-t-do-it.aspx

    Are you familiar with the tool?   Microsoft PST Capture Tool for Exchange 2010 and Office 365


    Сазонов Илья http://isazonov.wordpress.com/



    Wednesday, September 12, 2012 2:14 AM
  • I knocked this up for you - let me know if it doesn't work

    $sourcePath = $env:userprofile
    $targetPath = '\\servername\pstshare\' + $env:username
    $driveMappingLetter = 'N:'
    dir *.pst -Path "$sourcePath" -Recurse -ErrorAction SilentlyContinue | % ( $_.fullname ) { mv $_.fullname -Destination $targetPath }
    net use /persistent:yes $driveMappingLetter $targetPath
    Addendum: As per Bigteddy's notes, this requires the user to be logged on. As such, it will need to be part of the user login script.

    Thank you nigel. I will try this and let you know. is there anything I should change in the script except the servername?

    What does the driveMapping Letter part do?

    Wednesday, September 12, 2012 5:11 AM
  • Do you want to place the pst files in the network share? This is very bad practice http://blogs.technet.com/b/askperf/archive/2007/01/21/network-stored-pst-files-don-t-do-it.aspx

    Are you familiar with the tool?   Microsoft PST Capture Tool for Exchange 2010 and Office 365


    Сазонов Илья http://isazonov.wordpress.com/



    Hi ILYA

    Thanks for the response. Yes, i know it is bad practise but it is only to get all the .pst's in one place so that we can copy them and ingest them into the new platform

    The tool - is it only for Exch 2010 as we still on 2003 SP2

    Wednesday, September 12, 2012 5:13 AM
  • Good point. I did forget to mention that this will need to be run as a login script.

    CraMey, if you have more specific details about how you want to conduct the migration, that would help us to work something out for you.


    Ok, so it must be a logon script. What if we allready have a VB Script as a logon script via GPO for all users. Can one deploy more than one logon script via GPO?
    Wednesday, September 12, 2012 5:37 AM
  • Offtopic: Time to migrate to the 2010 version: v.next Exchange 2013 dont support direct migration from Exchange 2003.


    Сазонов Илья http://isazonov.wordpress.com/

    Wednesday, September 12, 2012 5:43 AM
  • Thanks - yes we are moving to hosted Exchange in the next 3 months which are 2010
    Wednesday, September 12, 2012 5:46 AM
  • The script will search for any pst files under the source path, so I am assuming that the current pst's are under the user's profile folder somewhere. If they're not, you'll need to change the sourcePath variable.

    For the variable driveMappingLetter, I assumed you were mapping the share to a drive letter, so that's pretty much what it does - maps your target path to the drive letter.

    Wednesday, September 12, 2012 8:32 AM
  • Sure, you can have multiple logon scripts. You can also call the powershell script from your main VBS logon script.

    If you have a deployment tool like SCCM, you can always run the script when the user is logged on.

    Wednesday, September 12, 2012 8:38 AM
  • The script will search for any pst files under the source path, so I am assuming that the current pst's are under the user's profile folder somewhere. If they're not, you'll need to change the sourcePath variable.

    For the variable driveMappingLetter, I assumed you were mapping the share to a drive letter, so that's pretty much what it does - maps your target path to the drive letter.

    Thanks Nigel

    Instead of a map drive, Can i not use a UNC path in the script to copy the pst to or must it be a map drive? this mean I will have to create map drives for all users before runing the script?

    Wednesday, September 12, 2012 11:39 AM
  • Sure, you can leave out the 3rd and 5th line altogether, as below:

    $sourcePath = $env:userprofile
    $targetPath = '\\servername\pstshare\' + $env:username
    dir *.pst -Path "$sourcePath" -Recurse -ErrorAction SilentlyContinue | % ( $_.fullname ) { mv $_.fullname -Destination $targetPath }


    • Proposed as answer by Nigel Finn Friday, September 14, 2012 3:18 PM
    • Marked as answer by Yan Li_Moderator Monday, September 17, 2012 1:42 AM
    Wednesday, September 12, 2012 1:06 PM