Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Need to do auto SnapShot to hyperv machine with powershell

$
0
0

Hello,

I need to do every week once a time snapshot to my v.machine

and i wnat to do it with power shell and than a task schdular.

i have a  scrip but i keep geting an error :

my script:

$VMManagementService = Get-WmiObject -Namespace root\virtualization -Class Msvm_VirtualSystemManagementService
$SourceVm = Get-WmiObject -Namespace root\virtualization -Query “Select * From Msvm_ComputerSystem Where ElementName=’Xamp’”
$result = $VMManagementService.CreateVirtualSystemSnapshot($SourceVm)
#ProcessWMIJob($result)
$VMManagementService = Get-WmiObject -Namespace root\virtualization -Class Msvm_VirtualSystemManagementService $SourceVm = Get-WmiObject -Namespace root\virtualization -Query “Select * From Msvm_ComputerSystem Where ElementName=’Xamp’”
$result = $VMManagementService.CreateVirtualSystemSnapshot($SourceVm) #ProcessWMIJob($result)

the Error :

 

Get-WmiObject : Cannot bind parameter because parameter 'Namespace' is specified more than once. To provide multiple values 
to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".

Any one help ???


Viewing all articles
Browse latest Browse all 15028


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>