3 Replies Latest reply on Feb 1, 2011 1:27 PM by LucD

    Invoke-VMScript fails after system updates.

    jwnchoate Enthusiast

      I updated my vsphere from 4.0 to 4.1, tools, my powershell tookit,and i noticed that now I cannot invoke script.  Everything has been updated.

      Now I have some scripts using Invoke-VMScript that error the same on all installs of PowerCLI, If I type in this command (the vm IS powered on for sure and tools are running, and vsphere client shows its powered and all good):


      $vm = Get-VM myVM

      Invoke-VMScript -VM $vm -ScriptText "dir" -HostUser root -HostPassword CorrectRootPass -GuestUser administrator -GuestPassword CorrectGuestPass



      I get this error:


      Invoke-VMScript : 2/1/2011 1:22:50 PM    Invoke-VMScript    197B3453-9367-4270-26CF-88A793C3B284    While performing operation 'Wait to connect to guest's VMware tools on VM 'myVM'' the following error occured: 'The virtual machine needs to be powered on'
      At line:1 char:16
      + Invoke-VMScript <<<<  -VM $vm -ScriptText "dir" -HostUser root -HostPassword CorrectRootPass -GuestUser administrator -GuestPassword CorrectGuestPass
          + CategoryInfo          : OperationStopped: (:) [Invoke-VMScript], VimException
          + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_VixWaitForJob_VixError,VMware.VimAutomation.Commands.InvokeVmScript


      I have a couple of different clients I run the toolkit from and both are failing with the exact same error not matter what command is run.


      if I echo $vm it also says the vm is powered on as well.