远程PowerShell脚本不适用Hyper-V快照
我正在尝试通过Power
Shell远程应用Hyper-V快照.我正在关注
Ben Armstrong’s guide.
顺便说一下,我在Server 2008 R2中. 简而言之: 连接到远程服务器: $password = ConvertTo-SecureString "password" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ("domainuser",$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 rootvirtualization Msvm_VirtualSystemManagementService -computername $HyperVServer # Get the virtual machine object $VM = gwmi MSVM_ComputerSystem -filter "ElementName='$VMName'" -namespace "rootvirtualization" -computername $HyperVServer # Find the snapshot that we want to apply $Snapshot = gwmi -Namespace rootvirtualization -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? 解决方法
文章明确指出:
ApplyVirtualSystemSnapshot在运行VM时无法远程工作 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- tfs – 自动测试和多个配置
- 在Windows 7 Java 7下破坏了Eclipse CVS extssh
- windows-server-2008-r2 – DHCP预留是否可以使用排除范围内
- windows – 如何从第N个位置获取批处理文件参数?
- 可以在Windows上使用activator -jvm-debug和Java 8调试Play
- 如何安装COM DLL的32位和64位版本并“自动选择”?
- 最好的Windows远程支持/屏幕共享工具?
- windows – 批处理脚本解释注释中的内容?
- [Qt] 文本文件读写, 摘自官方文档
- windows-server-2008 – LDAP身份验证:Windows Server2k3与