I created this small batch file to save my Outlook pst files (I tend to Archive a lot of mail) to a remote file share. When you run it, it grabs the PSTs in your Outlook default folder copies them on to your C: drive then to the share specified. I set it up to create a folder name after the day. For instance, today is 4/17/2009,  so it will create a folder name: 17 This way you will have a back up of your PST for at least 30 days. Enjoy!

::Saves Outlook PST in [YourNetworkDrive] for 30 days
::Change the drive letters to yours (H:)

@echo Saving your Outlook Archive PST file… please wait.
@echo off

:: variables
set drive=H:
set local=C:OutlookPST
set folder=%date:~7,2%
set backupcmd=xcopy /c /d /i /r /y
IF not exist %drive% goto NOHOME
IF not exist “%USERPROFILE%Local SettingsApplication DataMicrosoftOutlook*.pst” goto NOFILE
%backupcmd% “%USERPROFILE%Local SettingsApplication DataMicrosoftOutlook*.pst” %local%
%backupcmd% %local%*.pst %drive%OutlookArchive%folder%

echo msgbox”PST copied successfully” >C:copiedmsg.vbs
call C:copiedmsg.vbs
goto END

:NOHOME
echo msgbox”You are not mapped to (H:) therefore your PST backup cannot continue.” >C:NoHome.vbs
Call C:NoHome.vbs
goto END

:NOFILE
echo msgbox”There are no PST files to be saved. It was either never created, deleted or moved. NOTE: For this utility program to work your PST file needs to be in your default Outlook data folder.” >C:PSTError.vbs
Call C:PSTError.vbs

:END
set drive=
set folder=
set backupcmd=

exit

Advertisements