Skip to content

Instantly share code, notes, and snippets.

@painejake
Created March 7, 2011 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save painejake/858244 to your computer and use it in GitHub Desktop.
Save painejake/858244 to your computer and use it in GitHub Desktop.
A simple script to backup Outlook PST's to a network location
Dim FSO
Dim oShell
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set objOutlook = GetObject(, "Outlook.Application")
For Each objInspector In objOutlook.Inspectors
objInspector.CurrentItem.Save
objInspector.Close True
Next
objOutlook.quit
' Sleep for 600 to give Outlook time to release the PST files
WScript.sleep 600
' Path will need changing to your network location and PST location
FSO.CopyFile "C:\Outlook.pst", "\\server1\area$\Email\Outlook.pst"
FSO.CopyFile "C:\Archive.pst", "\\server1\area$\Email\Archive.pst"
oShell.Run "outlook"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment