Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251313

VM Tools Guest Operations Inconsistent Behaviors

$
0
0

I have this piece of code to verify whether a VM is ready to accept VM Guest Operations by vmtools.

```

    do {

      try { $vmToolsGuestOperationReady = (Get-View (Get-VM $VMName -Server $value.viServer -ErrorAction 'Stop')).Guest.GuestOperationsReady }

      catch { Write-Exception -ExceptionItem $PSItem }

      if ($vmToolsGuestOperationReady -eq 'True') {

        Write-Info "Virtual Machine `"$VMName`" VMWare Tools Operational in 5s"

        Start-Sleep -Seconds 5 # a bit more buffer

      }

      else { Start-Sleep -Seconds 3 }

    } until ($vmToolsGuestOperationReady -eq 'True')

 

 

```

Then after its ready, next piece of code as below

 

```

 

$copyJsonInfo = @{

      VM              = $VMName

      Source          = $jsonInfoPath

      Destination     = "C:\Users\Administrator\Desktop"

      LocalToGuest    = $true

      GuestCredential = $guestCred

      ErrorAction     = "Stop"

      WarningAction   = "SilentlyContinue"

      Server          = $value.viServer

}

 

Copy-VMGuestFile @copyJsonInfo | Out-Null

```

 

I got some inconsistent behaviors, sometimes the file get copied, but other times I got this error as below.

 

The guest OS for the virtual machine is unknown '$VMName'. The operation may fail.

Copy-VMGuestFile The guest operations agent could not be contacted.

 

This is tested on Windows Server as Guest OS.


Viewing all articles
Browse latest Browse all 251313


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>