-
Notifications
You must be signed in to change notification settings - Fork 0
/
Volume_Shadow_Copy_Task.ps1
49 lines (43 loc) · 2.15 KB
/
Volume_Shadow_Copy_Task.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
############## Set 3 daily Volume Shadow Copy Tasks #####################
if( -Not (Get-ScheduledTask -TaskName "Volume Shadow Copy C" -ErrorAction SilentlyContinue -OutVariable task) )
{
$Params = @{
Action = (New-ScheduledTaskAction -Execute 'cmd' -Argument '/c /c "wmic shadowcopy call create Volume=c:\" ')
Trigger = (New-ScheduledTaskTrigger -Daily -At 8am)
Principal = (New-ScheduledTaskPrincipal -GroupId "System")
TaskName = 'Volume Shadow Copy C'
Description = 'Volume Shadow Copy C'
}
Register-ScheduledTask @Params
Start-ScheduledTask -TaskName "Volume Shadow Copy C"
}
else
{
Start-ScheduledTask -TaskName "Volume Shadow Copy C"
}
if( -Not (Get-ScheduledTask -TaskName "Volume Shadow Copy C 2" -ErrorAction SilentlyContinue -OutVariable task) )
{
$Params = @{
Action = (New-ScheduledTaskAction -Execute 'cmd' -Argument '/c /c "wmic shadowcopy call create Volume=c:\" ')
Trigger = (New-ScheduledTaskTrigger -Daily -At 1PM)
Principal = (New-ScheduledTaskPrincipal -GroupId "System")
TaskName = 'Volume Shadow Copy C 2'
Description = 'Volume Shadow Copy C 2'
}
Register-ScheduledTask @Params
}
if( -Not (Get-ScheduledTask -TaskName "Volume Shadow Copy C 3" -ErrorAction SilentlyContinue -OutVariable task) )
{
$Params = @{
Action = (New-ScheduledTaskAction -Execute 'cmd' -Argument '/c /c "wmic shadowcopy call create Volume=c:\" ')
Trigger = (New-ScheduledTaskTrigger -Daily -At 6PM)
Principal = (New-ScheduledTaskPrincipal -GroupId "System")
TaskName = 'Volume Shadow Copy C 3'
Description = 'Volume Shadow Copy C 3'
}
Register-ScheduledTask @Params
}
######## Set Max Shadow Copies
New-ItemProperty registry::HKLM\System\CurrentControlSet\Services\VSS\Settings -Name MaxShadowCopies -PropertyType DWORD -Value 16
############# Resize Shadow Storage max size
vssadmin resize shadowstorage /for=C: /maxsize=5GB