Move all connected PST files

Hey folks,

before I start: yes I know PST files located on the network are a bad idea BUT we are looking to implement a vault solution, and need to consolidate all psts files in a central location.

Ok, my question!

I have found a fantastic script here http://scripts-and-bits.blogspot.com.au/ that will do most of what we need.

A few changes are required however:

  1. Some users may well have pst files with the same name located in different directories. The pstInfo.add pstPath,objFolder would need to amend the file name with _1, _2, _3, etc for each pst file it finds. These would need to be recorded in the array so it knows what to reconnect once copy has finished
  2. The script exludes empty pst file,  if not isEmpty(GetPSTPath(objFolder.storeid)) then. Given users may well run the script twice it would also need to exclude the destination folder, ie the "copylocation" folder
  3. It would initially need to check that the destination folder / "copylocation" folder exists, and is writeable by the current user, otherwise it pops up a msg box, eg Destination not valid, contact helpdesk, then quit

I've tested it on my own account and the code below works great.

I'm completely out of my depth however trying to add the functionality as listed above.

Can anyone shed some light on where I might start or even better amend the code to include the features?

If it were SAN/VMware/IOS stuff I might have a chance.. but I'm shooting in the dark when it comes to modifying array entries, etc.

Thanks for any help you might offer!

Shane.

'script will log current open PST files
'user must be logged on for script to work
'script will then move PSTs on a network share to the local drive
' This script assumes you are running XP

'set objects
On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("Wscript.Shell")
Set objNetwork = CreateObject("Wscript.Network") 

dim objNS,objOutlook, errorCounter

errorCounter = 0

Call OutlookObjects

strComputer = objNetwork.ComputerName 'returns computer name

'''''''''' setup log files
dim objTextFile, LogFolder
LogFolder  = "\\server\logs$\" & strComputer
Call CreateLogFile 'create log file

CheckLoggedOn 'checks to see if a user is logged on - exit if not logged in ****This will pick up the system account or runas account from SCCM - beware.


'setup dictionary
dim pstInfo
set pstInfo = createobject("scripting.Dictionary")

'setup array to store PST locations
Dim pstArray()
Dim counter : counter = 0

'read Outlook Data Stores
For Each objFolder In objNS.Session.Folders 'all data files in outlook
 if not isEmpty(GetPSTPath(objFolder.storeid)) then 'filter out empty items
  'wscript.echo objFolder
  pstPath = GetPSTPath(objFolder.storeid) 'returns the PST file path in text
  redim preserve pstArray(counter)
  pstArray(counter) = pstPath
  counter = counter + 1
  pstInfo.add pstPath,objFolder
  errorDisplay ("Read Data Store")
 End If
Next

displayMsg("-------  Open PST files --------") 'log all open PST files
pstKeys = pstInfo.keys 'log all open psts
for each key in pstKeys
 displayMsg(key)
Next

displayMsg("-------  Remove Network PST --------")
'remove all open PSTs on network shares
for each key in pstKeys
 If GetDriveType(left(key,2)) = "Network" Then 'if PST is stored on Network share....
 'wscript.echo key
 objNS.RemoveStore pstInfo.item(key) 'disconnect the PST - this will not delete it
 displayMsg("Removed " & key)
 errorDisplay ("Removing Store " & key)
 End if
Next

'creating path to outlook data folder - mydocuments\outlook files

'not using special folders as this will re-direct back to the H drive. Must use a hard coded path to the C: drive.
'myDocuments = objShell.SpecialFolders("MyDocuments")
'myDocuments = "c:\documents and settings\" & objNetwork.UserName & "\
copyLocation = "c:\documents and settings\" & objNetwork.UserName & "\My Documents\Outlook Files\"
'wscript.echo copyLocation
GeneratePath(copyLocation) 'create copy location if it does not exist

DisplayMsg("------   Copy to: " & copyLocation   & "-------")

'Quit outlook so we can move the PST
Call CloseOutlook

'copy PSTs
for each key in pstKeys
 If GetDriveType(left(key,2)) = "Network" Then
  'wscript.echo "copy " & key & " to " & copyLocation
  fileName = objFSO.GetBaseName(key) + ".pst" 'file name only so we can compare source and destination files
  destinationFileName = copyLocation & fileName
  DisplayMsg("Copy " & key & " to " & copyLocation)
  objFSO.copyfile key,copyLocation 'give time for copy to complete. WARNING.....if user has large PST eg 2GB it could take several minutes to copy.
  errorDisplay ("Copying " & key)
  wscript.sleep 500
  'wscript.echo ValidateCopy(key,destinationFileName)
 End If
Next

Call OutlookObjects

'add the PST files back into the store
for each key in pstKeys
 If GetDriveType(left(key,2)) = "Network" Then
  'wscript.echo ("add " & pstInfo.item(key))
  fileName = objFSO.GetBaseName(key) + ".pst"
  destinationFileName = copyLocation & fileName
  'wscript.echo "add " & destinationFileName
  displayMsg("Adding " & destinationFileName)
  objNS.AddStore destinationFileName
  errorDisplay ("Adding " & destinationFileName)
  wscript.sleep 500
 End If
Next

objShell.run "outlook.exe"

'Mark the following for deletion in log file
displayMsg("Mark the following PSTs for deletion")
for each key in pstKeys
 If GetDriveType(left(key,2)) = "Network" Then
  displayMsg("DELETE-" & key)
 End If
Next

Call QuitScript
'wscript.echo "complete"

''''''''''''' FUNCTIONS AND SUBS ''''''''''''''''''
Sub OutlookObjects
 Set objOutlook = CreateObject("Outlook.Application")
 Set objNS = objOutlook.GetNamespace("MAPI")
 wscript.sleep 3000
End Sub

Sub CloseOutlook
 objOutlook.Session.logoff
 objOutlook.Quit
 Set objOutlook = Nothing
 Set objNS = Nothing
 WScript.Sleep 3000 'give outlook time to close
 KillTask("outlook.exe") 'sometimes outlook does not exit - KILL IT!!!!!
End Sub

Function GetPSTPath(input)
 For i = 1 To Len(input) Step 2
 strSubString = Mid(input,i,2)
 If Not strSubString = "00" Then
 strPath = strPath & ChrW("&H" & strSubString)
 End If
 Next
 
 Select Case True
 Case InStr(strPath,":\") > 0
 GetPSTPath = Mid(strPath,InStr(strPath,":\")-1)
 Case InStr(strPath,"\\") > 0
 GetPSTPath = Mid(strPath,InStr(strPath,"\\"))
 End Select
End Function

Function GetDriveType(input) 'returns the type of drive the PST is stored on.
 strComputer = "."
 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 Set colItems = objWMIService.ExecQuery("Select * from Win32_logicaldisk")
 For Each objItem In colItems
  If objItem.driveType = "4" And  objItem.deviceID = input Then 'network drive
   GetDriveType = "Network"
  ElseIf objItem.driveType = "2" And  objItem.deviceID = input Then 'removable drive
   GetDriveType = "Removable"
  ElseIf objItem.driveType = "3" And  objItem.deviceID = input Then 'local disk
   GetDriveType = "Local Disk"
  End If
 Next
End Function

Function KillTask(input)
 'kill outlook if it is still running. If outlook is still running, it will prevent the copy of pst.
 strComputer = "."
 strProcessToKill = input

 SET objWMIService = GETOBJECT("winmgmts:" _
  & "{impersonationLevel=impersonate}!\\" _ 
  & strComputer & "\root\cimv2") 

 SET colProcess = objWMIService.ExecQuery _
  ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")

 count = 0
 FOR EACH objProcess in colProcess
  objProcess.Terminate()
  count = count + 1
 NEXT 

 'wscript.echo "Killed " & count & " instances of " & _
  'strProcessToKill & "on " & strComputer
End Function

Sub CreateLogFile
 'On Error Resume Next
 Const ForReading = 1
 Const ForWriting = 2
 Const ForAppending = 8
 '~~~~~~~~~~~~~~ Create Log Folder and Start Log File ~~~~~~~~~~~~~~~~~~~~~~~~~~
  'LogFolder  = "\\lonlon\logs$\" & strComputer
  LogFile = LogFolder & "\" & "pst1.log"

   If objFSO.FolderExists(LogFolder) = False Then
     Call GeneratePath(LogFolder)
   End if
   
 Set objTextFile = objFSO.OpenTextFile(Logfile, ForWriting, True) 'True=create new, false=don't

 DisplayMsg(" - Starting Script - ")
 DisplayMsg(" ")
 DisplayMsg(" - Date: - " & Date)
 DisplayMsg(" - Time: - " & Time)
 DisplayMsg(" - Logged on User: - " & objNetwork.UserName)
 DisplayMsg(" ")
 errorDisplay ("Create Log File")
End Sub 

Function GeneratePath(pFolderPath)
 GeneratePath = False
 If Not objFSO.FolderExists(pFolderPath) Then
   If GeneratePath(objFSO.GetParentFolderName(pFolderPath)) Then
    GeneratePath = True
    Call objFSO.CreateFolder(pFolderPath)
   End If
  Else
   GeneratePath = True
  End If
End Function
 
 
'~~~~~~~~~~~~~~ Write "DisplayMsg" variable to log file ~~~~~~~~~~~~~~  
Function DisplayMsg(strMessage)
 If iDisplayLogFile = 1 Then
  WScript.Echo strMessage
 End If
  objTextFile.WriteLine strMessage
End Function

Function errorDisplay (desciption)
 If Err.Number <> 0 Then
  DisplayMsg(" ERROR " & description)
  DisplayMsg("Error number: " & err.number)
  DisplayMsg("Error description: " & err.description)
  err.clear
  errorCounter = errorCounter + 1
 End If
End Function

Function GetFileSize(input)
 Dim File
 Set file = objFSO.GetFile(input)
 GetFileSize = file.size / 1024
End Function

Function ValidateCopy(source,destination) 'need to convert this to a md5 hash operation http://www.naterice.com/articles/66
 sourceFileSize = GetFileSize(source)
 destFileSize = GetFileSize(destination)
 if sourceFileSize = destFileSize Then
  ValidateCopy = "TRUE"
  displayMsg("File copy validated")
 Else
  ValidateCopy = "FALSE"
  displayMsg("************   WARNING - File copy operation appears to have failed")
 End IF
End Function

Function CheckLoggedOn
 strComputer = "."
 Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")
 
 For Each objItem in colItems
  strUserName = objItem.UserName
  If IsNull(strUserName) Then
   displayMsg("No one logged on - Exiting Script")
   wscript.exit 95
  Else
   displayMsg("User logged on - Continuing Script")
  End If
 Next
End Function

Sub QuitScript
 displayMsg("Exiting script with error code: " & errorCounter)
 wscript.quit errorCounter
End Sub

Function CheckProcess (input)
 set service = GetObject ("winmgmts:")
 'CheckProcess = "FALSE"
 for each Process in Service.InstancesOf ("Win32_Process")
  If Process.Name = input then
   'wscript.echo input & " running"
   CheckProcess = "TRUE"
  End If
 next
End Function


  • Edited by base_boot Wednesday, June 13, 2012 9:34 AM
June 13th, 2012 12:17pm

You're probably a little optimistic when expecting some respondent to analyse your 300 lines of code and add the extra functionality you require. Here are a few options you might consider:

  • Improve your scripting skills so that you can do the job yourself.
  • Pay someone to do it for you.
  • Break your request down into small modules, e.g. "How do I modify this subroutine so that it can cope with PST files residing in different folders bug having identical names". Remember to post the relevant subroutine.
Free Windows Admin Tool Kit Click here and download it now
June 13th, 2012 12:37pm

Hey Oberwald,

thanks for the reply and pointing out how best to ask the question!

1: I guess I'm confused with this bit:

'read Outlook Data Stores
For Each objFolder In objNS.Session.Folders 'all data files in outlook
if not isEmpty(GetPSTPath(objFolder.storeid)) then 'filter out empty items
  'wscript.echo objFolder
  pstPath = GetPSTPath(objFolder.storeid) 'returns the PST file path in text
  redim preserve pstArray(counter)
  pstArray(counter) = pstPath
  counter = counter + 1
  pstInfo.add pstPath,objFolder
  errorDisplay ("Read Data Store")
End If
Next

How do I amend the pstInfo so as each pst it finds it amends or indeeds starts with 1, 2, 3, etc

I can do the pstInfo.add 1,pstPath,objFolder  but how can I do a +1 so it updates with each one found?

2: within this I'm trying to get the following to work so it excludes the "copylocation" as somewhere to search for PST files:

For Each objFolder In objNS.Session.Folders

if not isEmpty(GetPSTPath(objFolder.storeid)) then

if not (copyLocation(objFolder.storeid)) then

But this looks all wrong to me!

3: The last part of the post I guess I can do with something like this:

'Is destionation path writable
If IsPathWritable(copyLocation) = False Then
' wscript.echo "Destination not valid, contact helpdesk."
wscript.quit
End If

I would love to have the time to really gte stuck into this and learn by fixing the prob myself. Unfortunately I need to have something for my manager by Friday and I'm starting to freak out cause no amount of googling is getting me anywhere!

Thanks again Oberwald for your reply... hopefully clarification on points 1 & 2 above will narrow it down.

Shane

June 13th, 2012 12:58pm

What Oberwald is suggesting is that you ask a single question about one item you are tying to change, do or is erroring.

I do not think anyone here has the time to try and decode your musing about what to do or how to do it.

Normally, when we set up a user with Outlook the 'OST' (if Exchange connected) is stored in teh profile.  If we use Exchange cached mode then this OST can be separate on each system and does not need to be backed up.  PST files are used for POP3 accoutns and for local copies of mail.  In this case the PST can be located in the profile and allowed to be redirected by Group Policy.  You do not need to 'move' the PST.  Just redirect the profile component. where the PST is stored (usually in a folder of 'My Documents').  Everything else will be done automatically since redirecting the folder will also update teh registry to reflect its new location.

I have been doing this this way since Outlook/Office 2000.,  I have never had an issue.

If Outlook is storing its PSTs in teh older default location (Local Settings/APplication data) then you will need to move the PST file to the MyDoc folder.  This can be done using a logon script but you will need to update the registry for the profile. 

The code to do this is should be in the repository.

http://gallery.technet.microsoft.com/scriptcenter/site/search?query=profile&f%5B2%5D.Value=profile&f%5B2%5D.Type=SearchText&f%5B0%5D.Value=Office&f%5B0%5D.Type=RootCategory&f%5B1%5D.Value=Microsoft%20Outlook&f%5B1%5D.Type=SubCategory&ac

June 13th, 2012 7:46pm

Hey JRV,

thanks for your reply.

Unfortunately we have users with PST's all over the place, both local and network.

As regards the issue with "psts with the same file name", I'm trying to do the following:

for each key in pstKeys
 If GetDriveType(left(key,2)) = "Network" Then
 changename = 1
  'wscript.echo "copy " & key & " to " & copyLocation
  fileName = objFSO.GetBaseName(key) + ".pst" 'file name only so we can compare source and destination files
  destinationFileName = copyLocation & fileName
  DisplayMsg("Copy " & key & " to " & copyLocation)
 If fso.FileExists(destinationFileName) Then
  destinationFileName = changename & "_" & destinationFileName
  changename = changename + 1
 End If
  objFSO.copyfile key,copyLocation 'give time for copy to complete. WARNING.....if user has large PST eg 2GB it could take several minutes to copy.
  errorDisplay ("Copying " & key)
  wscript.sleep 500
  'wscript.echo ValidateCopy(key,destinationFileName)
 End If
Next

The idea being that it would add a 1_ to the first same file, and then 2_ to the next, etc.

when I run it however I get

Error number: 424
Error description: Object required

Any ideas?

Shane.

June 14th, 2012 2:38am

You only need to move the PSTs in the profile.  Ignore the reast for now.  Move the profile.  Move all PSTS in the profiule to a folder in My Documents.  If the PST is already ther then ignote it.

I have done this  a dozen time.  You will not be able to write a single script that does everything.  Run a script that gives you a report of PST files in use in the profile.  Analyze that report.  Find the common denominators and move those files.  Mark your report as you complete the updates.  Soon the report should be nearly empty.  Manually fix the "hanging chad" at the end.

It is the only way I have found to bring order out of chaos.  It is a one time thing.  Abandon the idea that one script can do all of this.  Whoi cares.  Jssut do the big easy stuff first then divide and conquer.

We call this, among other things, step-wise refinement. (well I do anyway)

Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 3:21am

TO directlky addfress ytou question.  It is very hard to understand what you are ry8ing to code. 

I  really do not want to look at a lot of bad code and try to fix it.  Put trace messages into your code to tell you what is happening or not happneing.  That is the only way to debug spaghetti code.

Posting half of an error message is of no help.  You have no error management so it is implossible to know what is happening.  Yes - I suppose if I looked at tehis for an hourt I might guess at the issue - that's not going to happen.

June 14th, 2012 3:26am

Her eis a one tiome fix.  Notice how much easier it is to read whaen it is not full of oddbal comments and not indented correctly.

Please use the formatter to post code as it will make it readable.

for each key in pstKeys
    If GetDriveType(left(key,2)) = "Network" Then
    
        num = 0
        baseName = objFSO.GetBaseName(key)
        destinationFileName = copyLocation & baseName & ".pst"
        
        ' the following must be repetitive
        While fso.FileExists(destinationFileName)
             num = num + 1
             destinationFileName = copyLocation & baseName & "_" & num & ".pst"
        Wend
        
        WScript.Echo "Copy " & key & " to " & destinationFileName
        
        On Error Resume Next
        objFSO.copyfile key,destinationFileName
        If Err Then
             MsgBox Err.Description
             WScript.Quit
        End If
        On Error GoTo 0
        
    End If
Next

\_()_/






  • Edited by jrv Thursday, June 14, 2012 12:46 AM
  • Marked as answer by base_boot Thursday, June 14, 2012 10:08 PM
Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 3:40am

Hey JRV,

we use DFSr and folder redirection and thats part of the prob! If we put all PST files to My Doc's, then DFSr is pretty much useless as it tries to replicate 8GB+ pst files.

So the idea is to move them to a separate server(s) entirely. We are looking at a Vault solution, (Symantec), however this won't happen in the near future. By moving them to a separate server, outside of the user profile, we 'fix' DFSr and have an easily identifiable central location for PST files.

So the script above works great insofar as it will move all connected archives to a specified location. Youre spot on as regards breaking it down into smaller parts. Were not going to worry about user PST files that are not connected, just back them up to tape and restore as requested. (I hate PST files!)

I have put echos into the script.. but I cant figure out how to update a value in the array if the file names are the same.

It reads all data files and adds them to the array.

What Im trying to add is if a file with the same name is connected then add it to the array with 1_ at the start of the file name. If further files are connected with same file name then continue to add to array with 2_, 3_, 4_, etc.

I know Im asking a lot here.. but really struggling with this!

For Each objFolder In objNS.Session.Folders 'all data files in outlook

 if not isEmpty(GetPSTPath(objFolder.storeid)) then 'filter out empty items

  'wscript.echo objFolder

  pstPath = GetPSTPath(objFolder.storeid) 'returns the PST file path in text

  redim preserve pstArray(counter)

  pstArray(counter) = pstPath

  counter = counter + 1

  pstInfo.add pstPath,objFolder

  errorDisplay ("Read Data Store")

 End If

Next

June 14th, 2012 3:48am

JRV,

I think the issue I'm having is very similiar to this one:

http://social.technet.microsoft.com/Forums/en/ITCG/thread/e2249b46-ee8b-475e-871d-418da1efff4f

Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 4:10am

Are you on Exchange?  If on Exchange then why do you have PST file?

None of that matters.  Move the PSTs to a parallel structure bu moving then into 'Application Data"  Do not replicate with DFSR.  It is not necessary.  Just backup weekly.  You8 can even jsut set dfsr to sync only once per week.  I would just mirror occasionally using xcop or robocopy.

Corperote mail should be captured and archined at teh firewall for legal reasons.  In most companies it is not a requirement.  This allows you to provide a local app that will let users retriev older mail.  They only need to keep a month or so loccally and itf they lose a week the mail is still available if needed.  Mostly it is not needed.

Mail management is a specialty.  Just moving a bunch of PSTs around is not a solution.

One more time - please format the code with proper indentation. Please post the code as I demonstrated using the code formatter provided by this site.

Pl;ease post teh complete error message incluoing line numbers.  Point out the line that the error is about.  REmember we cannot see you screen and we cannot easily read you mind.  I leave that ot my more Religulous friends to do as I am not very good at circus tricks.

June 14th, 2012 4:40am

JRV,

I think the issue I'm having is very similiar to this one:

http://social.technet.microsoft.com/Forums/en/ITCG/thread/e2249b46-ee8b-475e-871d-418da1efff4f

Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 4:53am

JRV,

the solution to the issue that Macadio posted was to "change the name of EVERY file by adding an index to the name". Unfortunately though there's no code I can draw from whereby that happens.

We are using Exchange 2010, which I implemented some weeks back. Initially the plan was to use the Archive feature of Exchange 2010 and put the archive databases on a tray of slower 600GB FC disks. What I did not realise at the time is that if users are running Office 2007 Std then the version of Outlook does NOT support Archiving.

Woops! http://blogs.msexchange.org/walther/2010/12/15/still-waiting-for-outlook-2007-online-archive-support-reappearing/

So I've gone back to my manager and brought him up to speed. We will hopefully get Symantec Enterprise Vault approval to address the issue properly. In the meantime however I need to urgently move user PST's from their redirected My Doc's or their mapped home drive to a seperate server.

Thank you for the code you posted above. I added the following to check results:

DisplayMsg("------   Copy to: " & destinationFileName   & "-------")

It does appear to output the correct path and file name:

Copy J:\Archive\TEST Archive.pst to C:\Data\Archive_4\TEST Archive_1.pst

It then appears to go into a loop, insofar as the file never appears in the destination directory and my PC CPU usage is at 40% running the cscript process.

Oh yea, thanks for instruction on using the formatter, does indeed make it easier to read!

June 14th, 2012 5:31am

No - if you go back and really read the thread you will see that I told him to add an index.  That thread was muy answer.  Macadio apparently was able to use the information to fix his code.

You have not done that.  I just posted a fixed-up version of your code to show you how to add an index.  I don't think you even looked at it.

You need to go back and reread the 2010 requirements.  You can always archive but not back to the client.  Who cares?

Move everything to Exchange 2010 and cache user mails but leave the file on the client in its default location.

If users want a private archive then tell them the corporate archive is the "system of record" and any archiving they do is their responsiblilty.

Microsft has done well in reducing the mount of administration that is necessary.  Don't undo all of this good work by inventing a Rube-Goldberg method of managing email.

Software assurance was invented to protect you from the constantly changing MS environment.  Just keep updating at a predictable and budget-able cost.  What is spent by paying to upgrade software will be saved in reduced management costs and enhanced user satisfaction.  Very few companies throughout history have successfully done this. Hewlett-Packard, IBM, GE and Microsoft.  There are a few others but none that have done it as well as these companies.  They have defined the standards.

Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 6:05am

 

Hey JRV,

I agree with you completely, and Microsfot have gone so far as to ensure that network PST files and Outlook 2010 dont work Outlook freezes!

I work for a large government financial institution and unfortunately its not as simple as saying, PST files are archaic and need to be removed. Symantec Ent Vault will resolve the issue, but till then I have to make do.

I did look at your code and plugged it into my script.

Unfortunately though it appears to hang in a loop. The files never appear in the destination directory and the cscript.exe process just sits there running?

Any ideas?

Thanks!

June 14th, 2012 6:35am

It might be a good idea to stand back and review what you're actually trying to do. Working it out from the 300-line script that you copied from somewhere is not the best and most efficient way. Here is my impression:

  • Your users have a number of .PST files attached to Outlook.
  • These files reside in one or several local or networked folders.
  • There might be duplicated files names.
  • You wish to move all attached .PST files to a central location.
  • Files with duplicated names should be given unique names.

Is this what you're trying to do?
How will you tell Outlook where the moved files are?

Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 10:03am

I agree with you completely, and Microsfot have gone so far as to ensure that network PST files and Outlook 2010 dont work Outlook freezes!

That is not correct.  I have over 100 Outllo 2010 systems with PSTs on the network.  W e have them in My Documetns and that is redirected to a large file server.  There has never been a problem.  Some PSTs are pushing 2Gb.  ALl have now had teh PSTs converted to the Outlook 2007/10 type.  All configuration and movement was done with a combination of Group POlicy and some console time.

June 14th, 2012 10:50am

I did look at your code and plugged it into my script.

Unfortunately though it appears to hang in a loop. The files never appear in the destination directory and the cscript.exe process just sits there running?<//p<></ p<=""><//>

I have no idea what code you are talking about.  Do you mean your code that I fixed some of the  problems with.  I didn't say it fixed everything, only that it fixed some serious coding errors and was mostly posted to show you how to post code that is readable.

I have no idea what the rest of your code is doing and I don't intend to attempt to rewrite it to fix it.  You will have to do that yourself.  The loop I placed was to show you how to avoid file name issue.  If you keep running the code over and over it will keep creating more and more numbered copies of the same file.  I modified the output so you could see what was being done and placed an error trap.

It is my suspicion that you have an On Error Resume Next at the beginning of your script which Will make everything else not reliable.

You need to spend some time figuring out how to write a traceable and debug-able script.   Once you can see what is happening you Will figure out what you are doing wrong.   I just do not see what you need more than about 30 lines to find and move all attached PSTs.  I suspect that most of what you r script is doing is unnecessary.

If you have a question about some code issue we can try to answer it.  As others have pointed out we will not rewrite your code. 

Start small and try to get each piece to

Free Windows Admin Tool Kit Click here and download it now
June 14th, 2012 11:02am

Good morning folks,

we are yet to migrate to Office 2010, however speaking with friends working in other companies Outlook 2010 and network pst files can, and do, cause all manner of issues. Reports such as: http://social.technet.microsoft.com/Forums/en/outlook/thread/81c93d5d-7d21-4bfa-8ef4-9f18692e32c0 and further googling reveal the extent of the issues.

JRV you seem to have dodged the bullet that many of my friends observed, with profile redirection and default location of pst's under 2010 - My doc's, causing Outlook 2010 to lock up.

Thankfully the code now works fine, (thanks JRV), and does as is intended;

1.check what pst's users have connected to their outlook profile
2.close outlook and copy such pst's to definded location, respecting the possibility of same file name
3.reattach all pst files found in defined location
4.open outlook
Easy :)

There are a few more bits n' pieces I need to add:

1.do not check destination location for connected psts (if user runs the script again)
2.prevent user from launching outlook during the copy process by renaming the outlook.exe. Restore it once copy is complete
3.more logging!

I can post the code if either of you are interested.

Cheers.

June 15th, 2012 1:08am

JRV you seem to have dodged the bullet that many of my friends observed.

I will add this imaginative analogy to my collection. Can I join you some day in this bullet-observing activity? ;-)
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2012 1:30am

If you are not using 2010 then why bring it up?

Office 2010 has no serious issues when deployed correctly.  If an upgrade is from a very old and broken version of Office then you may ha issues.  I almost never upgrade.  Uninstall and reinstall.  Clean everything and start fresh. It is so easy to do with 2010 that it is almost the only way to go.

I have never seen Outlook 2010 'lock up'.  I have not seen many issues with Office at all on any platform or with any version.. We run it on large Terminal Servers with no issues and with roamed profiles.  Every problem I have seen with Office has come from untrained admins who have not taken the time to learn how to deploy and who have not tested their deployment scheme enough.

One issue that is addressed in the upgrade documentation is, if you have PSTs that have exceeded 2Gb then they will fail when Outlook is upgraded.  It is documented. You must fix that first before deploying.  Once you have deployed incorrectly almost anything can go wrong.  The same is true for almost any piece of complex software.

The one thing I can say about Office is that it is a beast that has grown rowdy.  It is being slowly rebuilt from the inside out and the outside in.  I am hoping the next release will be 100% Net classes but I suspect it won't.  The software source for Office is huge and it has to run the same on all platforms like 32/64 bit and Mac OS-X.

2010 is wonderful for deployment over any previous version. 

I recommend bringing in a consultant for large upgrades and spending at least a day or two letting the specialist set your compasses on the right course.

Like I said. The last two deployments went smoothly with 2010/07 and that was because we had prepped since the 2003/2007 updates and the 2002/2003 updates.  Once you get it right it works.

The problem with everyones custom deployment code besides being highly specific to one organization is that it also tends to maintain the same set of errors and mis-configurations.  The issues are never fixed and the next deployment will be every bit as painful.

I prefer to fix things and to not just put a bandaid on the problem and go home.

Most admins assume they will not be around for the next major update.  Wrong!  With the economy the way it is there is not much hope that any of todays line admins will be invited into management any time in the near future. 

Know that you will be deploying the next version over the top of what you are doing now.  Plan accordingly.

Good Luck

June 15th, 2012 1:40am

JRV you seem to have dodged the bullet that many of my friends observed.

I will add this imaginative analogy to my collection. Can I join you some day in this bullet-observing activity? ;-)

Mo.  I didn't dodge any bullets.  I just did my homework.  I also had some good admins that asked before leaping so I was able to prevent many disiaters.  The admins thatr I support on these sites are now getting very good.  I just wich their companies would send them to get certified.  It is a valuable lesson and can help you to feel more self assured about what is being done.

Free Windows Admin Tool Kit Click here and download it now
June 15th, 2012 1:43am

Hi Base_Boot

Would you be able to post the code please? I need to do something similar to what you've done.

Thanks

September 20th, 2012 10:57am

Base Boot: We implemented Symantec Enterprise Vault and were able to use its built-in automated facilities to migrate PST files into the Vault. Prior to that various admins had tried different strategies to discourage PST use, standardize it, help users get rid of PST files, just delete them, etc. The trouble was that these were all ad-hoc approaches having no clear solution in mind.

I appreciate that you feel the need to consolidate PST files *now* because of storage and other issues. One thing we have found is that users often have created PST files that they since have forgotten about, and they would not notice if they just disappeared. Another is that trying to get users to create PST files in a specific location setup for the purpose of being able to manage them is difficult. We have users who do not even know that they have created a file somewhere, they just think it is another email folder.

We finally stopped importing PST files into the vault from user home folders when we found that those whose PST files were already all imported were continuing to create new ones. We proposed a policy to prevent the creation of PST files altogether, however, this was not supported by the organization.

Although not yet a Symantec customer, you might be able to get some assistance from their support web site:

    http://www.symantec.com/business/support/index?page=landing&key=50996, or:
    http://www.symantec.com/connect/archiving-and-ediscovery/forums/enterprise-vault

I believe these are generally read-able, but that you have to register to be able to ask a question. I did that, but I do not remember having to provide proof of license.

I have also found that a google search mentioning the product name and the specific area of concern will often lead to symantec forum threads and KB articles on their website.

Free Windows Admin Tool Kit Click here and download it now
September 20th, 2012 7:58pm

Anyone have the full working code to share here?
January 28th, 2015 10:13pm

I am looking for a working script too.

@base_boot/Everyone: Please post the final working script if you can.

Free Windows Admin Tool Kit Click here and download it now
February 26th, 2015 9:26pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics