lamw / vmware-scripts

Various scripts for VMware based solutions
http://www.williamlam.com/
BSD 2-Clause "Simplified" License
859 stars 489 forks source link

Incorrect request to server #66

Open ghost opened 6 years ago

ghost commented 6 years ago

After finally figuring out how to run the "VMKeystrokes.ps1" script, I get the following error:

PowerCLI C:\> Set-VMKeystrokes -VMName $VM -StringInput "password" -ReturnCarriage $true
Sending keystrokes to ServerName ...

Exception calling "PutUsbScanCodes" with "1" argument(s): "Cannot complete the
operation due to an incorrect request to the server."
At C:\Projects\Automation\VMKeystrokes.ps1:159 char:5
+     $results = $vm.PutUsbScanCodes($spec)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : VimException

Any idea what might be causing that?

Thanks, Danni

lamw commented 6 years ago

What version of vSphere are you using? The API is only supported with 6.5 or greater

ghost commented 6 years ago

The vSphere Web Client is 6.5.

ghost commented 6 years ago

Also, to give you more information on the issue - I can see the tasks for "Put USB HID scan codes" in the Task & Events section of the VM I am trying to target.

image

lamw commented 6 years ago

Are you constantly getting this error using any string input? Can you try with another VM to see if its successful?

ghost commented 6 years ago

I have tried with multiple VMs with different OS and yes, any string input.

lamw commented 6 years ago

To rule out VC, can you try directly to an ESXi host to verify the script is working for you