Question : Backup multiple Open PST files using Volume Shadow Copy

Hi,

I found a script which uses the Volume Shadow copy Service [VSS] to copy open .pst files to a PST server [see script].

The script works really well after running a hotfix patch from MS and finding the correct version of VShadow.exe (different versions for all OS's).  

However, I need the script to be able to copy multiple .pst files from the PC to the PST server.  To reiterate, It needs to find all *.pst's and recreate them with their original names on the server.

I call the script with the following command to set the source and destination:
%~dp0CopyWithVss.bat "C:\Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Outlook\Archive.pst" B:\PSTBACKUPS\

Note, the vshadow.exe file and the batch file must be in the same directory.


Cheers
Lachlan
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
setlocal
 
@REM test if we are called by VSHADOW
if NOT "%CALLBACK_SCRIPT%"=="" goto :IS_CALLBACK
 
@REM
@REM Get the source and destination path
@REM
 
set SOURCE_DRIVE_LETTER=%~d1
set SOURCE_RELATIVE_PATH=%~pnx1
set DESTINATION_PATH=%2
 
@REM
@REM Create the shadow copy - and generate env variables into a temporary script.
@REM 
@REM Then, while the shadow is still live
@REM recursively execute the same script.
@REM
 
@echo ...Determine the scripts to be executed/generated...
 
set CALLBACK_SCRIPT=%~dpnx0
set TEMP_GENERATED_SCRIPT=GeneratedVarsTempScript.cmd
 
@echo ...Creating the shadow copy...
 
%~dp0vshadow.exe -script=%TEMP_GENERATED_SCRIPT% -exec=%CALLBACK_SCRIPT% %SOURCE_DRIVE_LETTER%
 
del /f %TEMP_GENERATED_SCRIPT%
 
@goto :EOF
 
:IS_CALLBACK
setlocal
 
@REM
@REM This generated script should set the SHADOW_DEVICE_1 env variable
@REM
 
@echo ...Obtaining the shadow copy device name...
 
call %TEMP_GENERATED_SCRIPT%
 
@REM
@REM This should copy the file to the right location
@REM
 
@echo ...Copying from the shadow copy to the destination path...
 
copy "%SHADOW_DEVICE_1%\%SOURCE_RELATIVE_PATH%" %DESTINATION_PATH%
 
:end

Answer : Backup multiple Open PST files using Volume Shadow Copy

I found my own solution in the end.  A friend created a VBScript:

Many thanks to Marsilies, but it your suggestion didn't quite do the job.


Lachlan
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Dim strFolder
Dim objNetwork
Set objNetwork = CreateObject("WScript.Network")
strFolder = "C:\Documents and Settings\" & objNetwork.UserName & "\Local Settings\Application Data\Microsoft\Outlook\"
 
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder (strFolder)
 
For Each objFile In objFolder.Files
 
 If UCase(objFso.GetExtensionName (objFile.Path)) = "PST"  Then
   Set objShell = WScript.CreateObject("WScript.Shell")
   objShell.Run("c:\CopyWithVss.bat """  & objFile.Path & """ C:\pst"), 1, True
 End If
Next
 
Random Solutions  
 
programming4us programming4us