$VMs = Get-Cluster “Cluster” | Get-VM | Where { $_.PowerState -eq “PoweredOn” }
ForEach ($VM in $VMs) {
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(‘LocalMachine’, $VM.Guest.Hostname)
Write-Host “Registry Value Before: “$VM.Guest.HostName “-” $reg.OpenSubKey(“SYSTEMCurrentControlSetServicesDisk”).GetValue(“TimeoutValue”)
$regKey= $reg.OpenSubKey(“SYSTEMCurrentControlSetServicesDisk”,$true)
$regkey.SetValue(‘TimeoutValue’,190,’DWord’)
Write-Host “Registry Value After: “$VM.Guest.HostName “-” $reg.OpenSubKey(“SYSTEMCurrentControlSetServicesDisk”).GetValue(“TimeoutValue”)
}
使用PowerCLI批量修改虚拟机的磁盘超时参数(Disk Timeout)
发表评论