我正在尝试在使用PowerCLI打补丁后删除旧快照。我现在使用的代码是:
Get-VM | Get-Snapshot | Remove-Snapshot -confirm$false它的工程great...but它只删除一个在同一时间,我希望它做2-3次。这个是可能的吗?
提前感谢!
发布于 2018-01-25 17:59:14
此代码将从所有虚拟机中删除多个快照:
Get-VM | Get-Snapshot | % { Remove-Snapshot $_ -Confirm:$false }我建议先选择单个虚拟机并进行测试:
$VM = Get-VM -Name 'My Virtual Machine'
$VM | Get-Snapshot | % { Remove-Snapshot $_ -Confirm:$false }经测试可在PowerCLI 6.5上运行。
发布于 2018-01-28 00:41:59
我建议您看一下'RunAsync‘参数。这将创建任务,然后转到下一个任务,而不等待前一个任务完成。
示例:
Get-VM | Get-Snapshot | Remove-Snapshot -RunAsync -Confirm:$falsehttps://stackoverflow.com/questions/48428713
复制相似问题