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

rick2021Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

markdmacCommented:
Sounds to me like you have PST files that are being used by users over the network.  This is not a supported configuration.  Move each user's PST file to their PCs and install the PST Backup utility (free download from http://office.microsoft.com).  That will then copy the PST files to the server for you when the user closes Outlook.  The files on the server won't be locked so you won't have a problem backing them up.
0
rick2021Author Commented:
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

0
markdmacCommented:
Exactly what the PST Backup utility is designed for.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

rick2021Author Commented:
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.
0
Steve KnightIT ConsultancyCommented:
Looking back I have a neglected alert for this but missed it at the time.   Could you try it from this simple batch file to see if it gives any pointers:

@echo off

REM Make dir if it doesn't exist
mkdir c:\PST 2>NUL

REM set StartPath for drive scan for PST's
CD C:\

REM Scan for all PST files under this start dir.  Exclude any in c:\pst\
for /R %%a in (*.PST) DO (
  echo Found %%~nxa at %%~dpa...
  if /i NOT "%%~dpa"=="c:\pst\" call c:\copywithvss.cmd "%%a" "c:\pst"
)

If you want it to do something different then let us know.

Steve
0
amwinsitCommented:
Rick,
I am currently running this script in my environment, with Win XP, and my users have multiple and large PST files.
What I did was write a few additional scripts and used scheduled tasks to complete this.

One thing i did notice different in your script was this line:
%~dp0\vshadow.exe -script=%TEMP_GENERATED_SCRIPT% -exec=%CALLBACK_SCRIPT% %SOURCE_DRIVE_LETTER%

My users are not admins so i used a program called lsrunase.exe to run the scripts as an admin

I placed all my files in a folder c:\tools which is hidden which included
Vshadow.exe, robocopy.exe, CopywithVSS.cmd, robocopy_pstsync.bat,vassadmin.bat, vssrun.bat

VSSadmin.bat (c:\tools\lsrunase.exe srvacctname domain password "c:\tools\vssrun.bat")
VSSRun.bat (c:\tools\CopyWithVSS.cmd c:\Outlook_PST\ c:\Outlook_PSTBackup>>C:\Tools\VSS.log)

The CopywithVSS.cmd is used to make a local copy from C:\Outlook_PST to c:\Outlook_PSTBackup it will also generate a log file to confirm if it ran or not.

With those files in place we scheduled to copy the PST files over at night after the user has left, cuts down on peak time bandwidth issues.

SCHTASKS /Create /SC daily /TN Robocopy /ST 19:00:00 /TR "c:\tools\robocopy_pstsync.bat"
 this was designated for desktop users who were instructed to leave their PC’s on at night

SCHTASKS /Create /SC weekly /D MON,TUE,WED,THU,FRI /TN VSS /ST 09:00:00 /TR "c:\tools\vssadmin.bat" /RU domain\srvacct /RP password
this was for laptop users to make copies every morning to have a good backup in case of corruption before it was copied later in the day

SCHTASKS /Create /SC daily /MO 2 /TN Robocopy /ST 12:00:00 /TR "c:\tools\robocopy_pstsync.bat" /RU domain\srvacct /RP password  
this was for laptop users and theirs would copy up at lunch time of every second day of the week

robocopy_pstsync.bat  (c:\tools\robocopy c:\Outlook_PSTBackup\ \\servername\share /V /NP /XO /R:1 /W:1 /LOG+:\\servername\share\ username.log)
 this is the task that would run at night and create a log file with history of the success or fail of the copy.

I know there is a lot of info here, if you have any questions on any of these files or additional scripts let me know.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.