简体   繁体   English

Powershell命令将Hyper-V Guest状态保存到磁盘

[英]Powershell command to save a Hyper-V Guest state to disk

Does anybody know the command to save the state of a hyper-v guest-os from powershell? 有人知道从powershell保存hyper-v guest-os状态的命令吗?

Ex) 例)

Save-VM GuestName ? 保存VM GuestName?

Take a look at http://pshyperv.codeplex.com The PowerShell module there for Hyper-V management has the cmdlets for working with virtual machines. 请查看http://pshyperv.codeplex.com用于Hyper-V管理的PowerShell模块具有用于处理虚拟机的cmdlet。

In the above module, for discovering and manipulating Machine states: 在上面的模块中,用于发现和操纵机器状态:

Get-VMState
Set-VMState
Convert-VmState
Ping-VM
Test-VMHeartBeat
Shutdown-VM
Start-VM
Stop-VM
Suspend-VM

So, to answer your question, to save VM state, the cmdlet will be Set-VMState 因此,要回答您的问题,要保存VM状态,cmdlet将为Set-VMState

If you don't want to use any module and write your own function using WMI, take a look at MSDN documentation for Hyper-V WMI interfaces. 如果您不想使用任何模块并使用WMI编写自己的函数,请查看Hyper-V WMI接口的MSDN文档。

http://msdn.microsoft.com/en-us/library/cc723874(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/cc723874(v=VS.85).aspx

Ravikanth's answer looks complicated and takes a lot of reading.. but this works for me: Ravikanth的答案看起来很复杂并需要大量阅读......但这对我有用:

Stop-VM -name vmName

Or type: Get-VM | Stop-VM -save 或者输入: Get-VM | Stop-VM -save Get-VM | Stop-VM -save to put all machines in a saved state. Get-VM | Stop-VM -save将所有机器置于保存状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM