VMware Cloud Community
13216544
Contributor
Contributor

PowerCLI Wait-Tools error Object reference not set to an instance of an object

I want to use the Wait-Tools PowerCLI command as so: Wait-Tools -VM $my_vm -TimeoutSeconds 180

This is how it is written in the API, however I get the following when running it.

Wait-Tools : 17/10/2013 00:03:41    Wait-Tools        Object reference not set to an instance of an object.   

At C:\Users\Admin\Downloads\Script.ps1:164 char:5

+     Wait-Tools -VM $my_vm -TimeoutSeconds 180

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Wait-Tools], ViError

    + FullyQualifiedErrorId : Client20_ClientSideTaskImpl_ThreadProc_UnhandledException,VMware.VimAutomation.ViCore.Cmdlets.Commands.WaitTools

All my other scripts are working fine, just this 1 command is having problems.

0 Kudos
4 Replies
mattboren
Expert
Expert

Hello, -

Not sure that it is related, but what versions of PowerCLI and VIX are installed on your machine?  And, do you have another machine with PowerCLI installed from which you can test the same Wait-Tools command?

There is a thread with similar symptoms [towards end], and suspicion was on the PowerCLI / VIX installation on the machine running the command:  https://communities.vmware.com/thread/454259

Something to look at, at least.

0 Kudos
13216544
Contributor
Contributor

Yeah, I saw this but wasn't very conclusive,

I thought VIX was installed when you install PowerCLI.

I'm using PowerCLI version 5.1.0.4977. Looks like VIX is not installed.

What's more confusing is that this command is in the PowerCLI API, so why do I need VIX?

If I do need it, how do I know what version to download and where can I get it from?

Thanks

0 Kudos
mattboren
Expert
Expert

Hello-

Yes, VIX generally is installed when one installs PowerCLI.  One exception to that is if VMware Workstation is installed -- VIX may not get updated/upgraded at PowerCLI time, per some PowerCLI release notes.

Several of the PowerCLI cmdlets utilize the VIX API for operations on guest OSes, like Invoke-VMScript, Copy-VMGuestFile, etc.  I was not able to find reference in VMware docs, but I seem to remember that Wait-Tools also utilizes VIX.

As for "what version" and "from where" -- you can grab the VIX SDKs at http://www.vmware.com/support/developer/vix-api/.  For your version of PowerCLI (5.1 rel1), I believe that the major version of VIX is 1.10.  From that link you can "Select a release" to get to the desired VIX version.

Another thought is that you might try to uninstall / reinstall PowerCLI (if you haven't already), to have the PowerCLI installer itself add the bundled version of VIX.  Or, do you have Workstation installed (and, so, this would likely not achieve much)?

0 Kudos
pngfei
Contributor
Contributor

Even though this thread is very old, I want to share what I found.

Wait-Tools Object reference not set to an instance of an object

This error take place when VM power on at the very beginning, after a 2 or 3 seconds, wait-tools call will succeed.

If the VM restart, the wait-tools call will work as expected.

If the VM powered on from off totally, at the first 1 second, wait-tools call will fail with the error.

I guest this might be VM instance is not initialized fully.

0 Kudos