Link to home
Start Free TrialLog in
Avatar of rick2021
rick2021

asked on

Script to backup PST files w/ vshadow.exe

I need a script that uses CopyWithVSS.cmd (the code below) and vshadow.exe to backup  multiple PST files -i've tried this in the past and I could not get it to work...
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... 
  
c:\vshadow.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

Open in new window

SOLUTION
Avatar of markdmac
markdmac
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rick2021
rick2021

ASKER

No these are PST files that are local on the user's computer...we need it backed up to a server not an exchange server we are currently using this snippet of code but all it does is make the folder and it doesnt back up anything...
Dim strFolder 
Dim objNetwork 
Set objNetwork = CreateObject("WScript.Network") 
strFolder = "C:\" 
  
Set objFso = CreateObject("Scripting.FileSystemObject") 
Set objFolder = objFso.GetFolder(strFolder) 

If Not objFSO.FolderExists("c:\PST") then
	Set PSTFolder=objFSO.CreateFolder("c:\PST")
End if

  
For Each objFile In objFolder.Files 
  
 If UCase(objFso.GetExtensionName(objFile.Path)) = "PST" Then 
   Set objShell = WScript.CreateObject("WScript.Shell") 
   objShell.Run("c:\CopyWithVss.cmd """  & objFile.Path & """C:\pst"), 1, True 
 End If 
Next

Open in new window

Exactly what the PST Backup utility is designed for.
This utility does not do it if Outlook is open which is exactly what we need it to do - we are using a piece of backup software called Robocopy...we need it to use the code above or something that works with the vshadow and CopyWithVSS.cmd code...we really need this.
SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.