VbScript to Perform the Shadow Copy RRS feed

  • Question

  • Hi Everyone ,

                      I need to create the VbScript which will configure the Shadow Copy on the Drive . Actually i want to acheive this ..If you right click on Volume you have option for the Configure Shadow Copy .Once you click that you have options of setting once you click the same .You natively have two tasks


    1. COnfigure the Storage Area

    2. Schedule the Task

    I am able to script the Stroage Area and COde as below


    Set objShadowStorage = objWMIService.Get("Win32_ShadowStorage")
        errResult = objShadowStorage.Create(VOLUME, DIFFERENTIAL_VOLUME)


    However i am able to create the Schedule Task as it creates with the same parameters if you creates it manually with the script as below

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set objVol = objWMIService.ExecQuery("Select * From Win32_Volume ")

    For Each Item In objVol

    If Item.DriveLetter="G:" then
    WScript.Echo DeviceG
    End IF

    Set objShell = CreateObject("WScript.Shell")
    objExecObject = objShell.Run ("cmd.exe /c schtasks.exe /create /RU" &" " & Chr(34)& "SYSTEM" & Chr(34) &" " &" /SC Weekly /D Mon,TUE,WED,THU,FRI /TN ShadowCopyVolume" &StrDeviceID &" " &"/TR" &" " & Chr(34)  &"C:\Windows\System32\vssadmin.exe Create Shadow AutoRetry=15\For=" &DeviceG & "\" & " "  & "%systemroot%\system32"  & Chr(34) &" " &"/ST  07:00 /RL HIGHEST")


    However even when i run this task it does exactly what it suppose to do but it not getting reflected on the Volumn. It still says Disabled as when you click on the Configure Shadow Copy option . Howvever when the shadow Copy scheule created with Configure shadow Copy wizard it shows enable ..how can i make this happen ???


    Thanks and Regard

    Kaushal Pandey







    Tuesday, August 2, 2011 11:10 AM