We help IT Professionals succeed at work.
Get Started

Script to backup PST files w/ vshadow.exe

2,125 Views
Last Modified: 2013-12-01
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

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 3 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE