Method for setting up Volume Shadow Copies on Server Core

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.


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.


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"
}

From a SERVER OS (not Windows 10) you can follow these steps:

  1. Open Computer Management.
  2. "Connect to another computer" (your Core server)
  3. Expand System Tools
  4. Right-click Shared Folders > click All Tasks > and click Configure Shadow Copies.

For anyone else who ends up here after all this time, it's a lot easier now. This is how I did it in Server Core 2019

-Create a shadow copy on the C drive with VSSAdmin

vssadmin add shadowstorage /for=C: /on=C: /MaxSize=10GB

-Use PowerShell to create a scheduled task that takes a copy twice daily Monday-Friday

$Action=new-scheduledtaskaction -execute "c:\windows\system32\vssadmin.exe" -Argument "create shadow /for=C:"

$TriggerDaysOfWeek=@(
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
)

$Trigger=@(
$(new-scheduledtasktrigger -weekly -DaysOfWeek $TriggerDaysOfWeek -at 11:00AM),
$(new-scheduledtasktrigger -weekly -DaysOfWeek $TriggerDaysOfWeek -at 5:00PM)
)
Register-ScheduledTask -TaskName ShadowCopyC -Trigger $Trigger -Action $Action -Description "ShadowCopyC" -user SYSTEM