lamw/vmware-scripts

Incorrect request to server

Opened this issue · 6 comments

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

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

The vSphere Web Client is 6.5.

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

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

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

lamw commented

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