I am this weird problem while working with powershell.When I run a while loop to check if the VM tools status, it gets stuck inside only. Here's the code:
Connect-VIServer $vmserver -User $vmuser -Password $vmpass
$status1 = (Get-VM -Name $vmname).Extensiondata.Summary.Guest.ToolsStatus
Write-Host $status1
while(!($status1 -eq 'toolsOK')){
Write-Host "tool status is:" $status1
Start-Sleep -Seconds 5
}
Write-Host "success"
I ran this code when that machine was off and in b/w started that machine($vmname).While it was swtiched off it's understood that "tool status is:"toolsNotRunning.But even after getting switched on and getting the remote of machine it shows same status,whereas I checked in ESXI status was running.I tried the above mentioned thing like it might get stuck so pressed ENTER,Mouse click etc,but no USE..I am using powershell ISE-host,version3.0..