You are right testuser was created only on guest OS so this probably could not work.
I could not follow the Invoke-VMScript – least privilege because it is probably for ESX 4.1 (I do not have VirtualMachine.Interact.GuestControl privilege)
This time I created yet another user. It exists on guest OS and in ESX vSphere GUI it is displayed in View->Administration->Roles.
There is a role=username, the role has username user under ha-folder-root, the username role has Virtual Machine->Interaction->Console interaction privilege.
Still the result is:
Invoke-VMScript : 5/17/2013 9:59:21 AM Invoke-VMScript While performing operation 'Connect to host service 'https://<my ESX 4.0 IP>/sdk' at port 902' the following error occured: 'Insufficient permissions in host operating system'
Is there a way to debug this thing somehow/turn on some logs?