Task scheduler to create Shadow Copy

From Tech-Wiki
Jump to: navigation, search

Back to Misc

Create a daily task with high privileges and following action:

Program: wmic
Parameter: shadowcopy call create Volume=C:\

If it's requried to increase the size of Shadow Storage:

vssadmin Resize ShadowStorage /For=C: /On=C: /MaxSize=20%

To create this via Powershell use:

$volumeinfo = GWMI -namespace root\cimv2 -class win32_volume 
$volumeid = $volumeinfo[1].deviceid 
$taskname = "ShadowCopyVolume" + $volumeid.replace("\","").replace("?Volume","") 
$taskrun = "C:\Windows\system32\vssadmin.exe Create Shadow /AutoRetry=15 /For=$volumeid" 
schtasks /create /F /RU SYSTEM /SC DAILY /ST 08:00 /RI 240 /DU 48:00 /K /V1 /TN $TaskName /TR "$taskrun" 

Command above is for server only, on desktop use one of these:

(gwmi -list win32_shadowcopy).Create('C:\','ClientAccessible') 
wmic shadowcopy call create Volume='C:\'