Ill try to explain this so it makes sense because I'm baffled...
I'm creating a script that makes the OS reboot, then waits for vmtools to populate the OS data in extensiondata and then continues when there is a value in that field that isn't blank
Beyond that I'm telling the script to do 2 different things depending on the OS version running.
The problem is the $VM variable never populates the OS name by itself in the "while" loop, it always throws a blank return if i run $vm.ExtensionData.Guest.GuestFullName
if i stop the script and manually run the command $vm = get-vm -Name $vm it populates corrently without issue.
This portion of the script is Right after the OS comes back up from the reboot:
while($vm.ExtensionData.guest.GuestFullName -eq $null){
Write-host "waiting for Guest OS to populate from vmtools..."
start-sleep -s 3
$vm = get-vm -Name $vm
}
if($vm.ExtensionData.Guest.GuestFullName -like "*2012*"){
Write-host "Test"
}
elseif($vm.ExtensionData.Guest.GuestFullName -like "*2008*"){
Write-host "Test2"
}
else{
Write-host "failed"
}
I'm getting the "failed" every time.
Ill try to explain in more detail if anyone's willing to help
thanks!