7

Is there some obvious method I am not finding for how to setup the periodic creation of shadow copies for a given drive on a system running Windows without a GUI?

From what I can tell going to the Shadow Copies tab of disk properties and clicking the Enable button basically just creates a couple scheduled tasks. These scheduled tasks seem to use some kind of GUID unique to each volume? so this isn't something that I could easily do with a Group Policy.

There must be some simple method to enabling shadow copies from the command line right?

7

You'd think this should be easy, wouldn't you? Well, you'd be wrong. It's not.

Shadow Copies of Shared Folders is available in all editions of Windows Server 2008 R2. However, the user interface is not available for the Server Core installation option. To create shadow copies for computers with a Server Core installation, you need to manage this feature remotely from another computer.

If easy's out of the question... see this thread, where they try go at it the hard way. I love to automate things, but in this case, I think it's much more effort than just using the GUI initially.

  • From what I can tell the method for remotely configuring this won't work remotely from Windows 7, or 8.1 enterprise with the remote admin tools. This only seems to work from the a Windows Server version of mmc. – Zoredache Jul 15 '14 at 19:06
  • @Zoredache I see that. In checking into this myself, I noticed that vssadmin has a Create Shadow command on Server OSes - that might do what you're looking for. – HopelessN00b Jul 15 '14 at 19:40
3

Instead of remotely configuring the setting, you could just create a scheduled task through Group Policy. As you mentioned, the task created during the normal method uses a volume ID; its action looks something like this:

vssadmin.exe Create Shadow /AutoRetry=15 /For=\\?\Volume{f9d9bfa1-f506-f24f-f54f-fe6ef47fd6f4}\

So of course the challenge for you would be making a GPO that would work for all computers.

I propose having your schedule be a small powershell snippet that finds the volume ID and calls the same command.

I'm going to assume you want to do this for the system drive. In that case, code like this should work on PowerShell 2.0+:

$volID = Get-WmiObject Win32_Volume | Where-Object { $_.DriveLetter -ieq $env:SYSTEMDRIVE } | Select-Object -ExpandProperty DeviceID
Start-Process 'vssadmin.exe' -ArgumentList "Create Shadow /AutoRetry=15 /For=$volID" -Wait

This is shown as 2 lines here so you can more easily see what's going on, but obviously if you intend to call your task without an external script file (which would complicate things) you would have to have it all on one line. You can separate the lines with a semi-colon, you could just embed the entire volume ID retrieval line in the string with $(), etc.

You could also use powershell's -EncodedCommand parameter to deal with quoting. This lets you have a nice readable multi-line script that you can sit on a share somewhere. You base64 encode that script and then pass the entire thing to powershell with -EncodedCommand.

I can expand on those options if needed, assuming this code would meet your needs.

1

This is what I use in PowerShell. Its a link to my site, but it looks a lot better than it does pasted here.

#Enable Volume Shadow copy
clear
$Continue = Read-Host "Enable Volume Shadowcopy (Y/N)?"
while("Y","N" -notcontains $Continue){$Continue = Read-Host "Enable Volume Shadowcopy (Y/N)?"}
if ($Continue -eq "Y") {
#Enable Shadows
vssadmin add shadowstorage /for=C: /on=C:  /maxsize=8128MB
vssadmin add shadowstorage /for=D: /on=D:  /maxsize=8128MB
#Create Shadows
vssadmin create shadow /for=C:
vssadmin create shadow /for=D:
#Set Shadow Copy Scheduled Task for C: AM
$Action=new-scheduledtaskaction -execute "c:\windows\system32\vssadmin.exe" -Argument "create shadow /for=C:"
$Trigger=new-scheduledtasktrigger -daily -at 6:00AM
Register-ScheduledTask -TaskName ShadowCopyC_AM -Trigger $Trigger -Action $Action -Description "ShadowCopyC_AM"
#Set Shadow Copy Scheduled Task for C: PM
$Action=new-scheduledtaskaction -execute "c:\windows\system32\vssadmin.exe" -Argument "create shadow /for=C:"
$Trigger=new-scheduledtasktrigger -daily -at 6:00PM
Register-ScheduledTask -TaskName ShadowCopyC_PM -Trigger $Trigger -Action $Action -Description "ShadowCopyC_PM"
#Set Shadow Copy Scheduled Task for D: AM
$Action=new-scheduledtaskaction -execute "c:\windows\system32\vssadmin.exe" -Argument "create shadow /for=D:"
$Trigger=new-scheduledtasktrigger -daily -at 7:00AM
Register-ScheduledTask -TaskName ShadowCopyD_AM -Trigger $Trigger -Action $Action -Description "ShadowCopyD_AM"
#Set Shadow Copy Scheduled Task for D: PM
$Action=new-scheduledtaskaction -execute "c:\windows\system32\vssadmin.exe" -Argument "create shadow /for=D:"
$Trigger=new-scheduledtasktrigger -daily -at 7:00PM
Register-ScheduledTask -TaskName ShadowCopyD_PM -Trigger $Trigger -Action $Action -Description "ShadowCopyD_PM"
}
  • Suggest to indent first time in your life. – peterh Jan 30 '15 at 16:18
0

My main problem really is that Windows 7.0, 8.1 cannot configured shadow copies on a remote system even with the RSAT tools installed.

The remote GUI methods are fine now that I realize I must be running the tool from Windows server. The various scripted and powershell methods to accomplish this would work, but I didn't really require that in most situations.

  • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. – Andrew Schulman Nov 29 '14 at 8:40
  • The 'answer', for me, was was to use the GUI from a server OS, since the workstation OS doesn't include the feature, and the other options are a pain. Yes, I know this doesn't exactly answer my question as written, but this is the 'answer' I used to the problem I was having, which I thought others might find helpful. – Zoredache Dec 1 '14 at 19:27
0

To enable and configure Shadow Copies of Shared Folders

1.Open Computer Management. 2.In the console tree, right-click Shared Folders, click All Tasks, and click Configure Shadow Copies. 3.Click the volume where you want to enable Shadow Copies of Shared Folders, and then click Enable. 4.To make changes to the default schedule and storage area, click Settings.

found here http://itsimple.info/?p=458

  • I think you may have missed the point of the question. This is for the 'Server Core'. There is no 'computer management' mmc locally. And the issue that eventually identified is that the 'VSS' options don't show up win 'computer management' tool available on Windows 7/8.1/10. – Zoredache Aug 30 '18 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.