我正在尝试通过Power
Shell远程应用Hyper-V快照.我正在关注
Ben Armstrong’s guide.
顺便说一下,我在Server 2008 R2中.
简而言之:
连接到远程服务器:
$password = ConvertTo-securestring "password" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ("domain\user",$password) Enter-PSSession -Computer computerName -Credential $cred
应用快照:
$HyperVServer = Read-Host "Specify the Hyper-V Server to use (enter '.' for the local computer)" # Prompt for the virtual machine to use $VMName = Read-Host "Specify the name of the virtual machine" # Prompt for the name of the snapshot to apply $SnapshotName = Read-Host "Specify the name of the snapshot to apply" # Get the management service $VMMS = gwmi -namespace root\virtualization Msvm_VirtualsystemmanagementService -computername $HyperVServer # Get the virtual machine object $VM = gwmi MSVM_ComputerSystem -filter "ElementName='$VMName'" -namespace "root\virtualization" -computername $HyperVServer # Find the snapshot that we want to apply $Snapshot = gwmi -Namespace root\virtualization -Query "Associators Of {$VM} Where Assocclass=Msvm_ElementSettingData ResultClass=Msvm_VirtualSystemSettingData" | where {$_.ElementName -eq $SnapshotName} | select -first 1 # Apply the snapshot $VMMS.ApplyVirtualSystemSnapshot($VM,$Snapshot)
我逐个执行这些,它发现VM和快照很好,但是当我执行最后一个命令时,我的快照没有被应用.它也没有失败,没有错误消息.
但是,在执行最终命令后,我确实得到了以下内容:
__GENUS : 2 __CLASS : __ParaMETERS __SUPERCLASS : __DYNASTY : __ParaMETERS __RELPATH : __PROPERTY_COUNT : 1 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : ReturnValue : 32775
根据this MSDN page,此返回值表示此操作的无效状态(32775).这是什么意思?如何修复此问题以实际应用快照?
VM当前处于运行状态,因此我再次尝试关闭VM并正确应用快照.
如何强制快照应用于处于运行状态的VM?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。