Anyone have a script that enables shadow copy/previous version for Win10?

YeOldeStonecat

Well-Known Member
Reaction score
6,751
Location
Englewood Florida
Yeah now that Win10 is near the end of its run I'm looking...lol.
So, back in the Win7 days, enabling previous versions was easy peasy, right click 'n done!
But with Win10, to do it properly, gotta go one place to enable it on a volume, and go to another place to schedule tasks to grab shots.

While many (ideally most) of our clients are on 365...and OneDrive is grabbing the impo-tant stuff...we had a situation yesterday with a call in client, where...a few of our guys wish to just have a script to enable it on clients we have that are just workgroups, no 365 yet,

Just curious if someone found a good script they have in their toolkit to enable it fully on Win10. And we can make it part of our regular onboarding process.
 
So far, found this one on Reddit...seems to work good.


[array]$drives=(Get-PSDrive -PSProvider 'FileSystem'| select *| where {$_.Free -ne $null}).Name ForEach ($driveletter in $drives){ $r=([WMICLASS]"root\cimv2:win32_shadowcopy").create("${driveletter}:\", "ClientAccessible") write-host "${driveletter} drive's shadowcopy status was: " $r.ReturnValue } vssadmin.exe resize shadowstorage /for=C:/ /On=C: /MaxSize=10% #Set Shadow Copy Scheduled Task for C: AM $Action=new-scheduledtaskaction -execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "wmic shadowcopy call create Volume='c:\'" $Trigger=new-scheduledtasktrigger -daily -at 9:00AM Register-ScheduledTask -TaskName ShadowCopyC_AM -Trigger $Trigger -Action $Action -Description "ShadowCopyC_AM" -User "System" #Set Shadow Copy Scheduled Task for C: PM $Action=new-scheduledtaskaction -execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "wmic shadowcopy call create Volume='c:\'" $Trigger=new-scheduledtasktrigger -daily -at 4:00PM Register-ScheduledTask -TaskName ShadowCopyC_PM -Trigger $Trigger -Action $Action -Description "ShadowCopyC_PM" -User "System"
 
You may want to avoid using WMIC, since it's deprecated and could end up being removed from Windows 10.
 
Back
Top