Want more features on Pastebin? Sign Up, it's FREE!
Guest

Create HyperV SnapShots

By: a guest on Nov 15th, 2012  |  syntax: Power Shell  |  size: 0.43 KB  |  views: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $array = "HostName1","HostName2"  #etc. As many as you'd like.
  2.        
  3. Foreach ($h in $array) {
  4. $VMManagementService = Get-WmiObject -ComputerName $h -Namespace root\virtualization -Class Msvm_VirtualSystemManagementService
  5. $SourceVm = Get-WmiObject -computername $h -Namespace root\virtualization -QuerySelect * From Msvm_ComputerSystem"
  6. Foreach ($i in $SourceVm)
  7.    {$VMManagementService.CreateVirtualSystemSnapshot($i)
  8.    }
  9. }
clone this paste RAW Paste Data