Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Created December 6, 2017 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomfanning/babf69c576e02b913cc27f0d9224840e to your computer and use it in GitHub Desktop.
Save tomfanning/babf69c576e02b913cc27f0d9224840e to your computer and use it in GitHub Desktop.
Back up Hyper-V VMs to a network share
$errorActionPreference='Stop';
remove-item -recurse -force c:\backup\tsl.prev -ErrorAction Ignore
rename-item c:\backup\tsl c:\backup\tsl.prev
get-vm | where-object -Property Name -like 'tsl.*' | export-vm -path c:\backup\tsl;
robocopy C:\backup\TSL \\sg-81-vmhost\usb-backup\TSL *.* /mir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment