Does Invoke-VMscript in PowerCLI 4.1.1 still needs special priviliges on ESX hosts, like in previous versions ?
With powercli 4.1 I never figured out how to use Invoke-VMscript without using root ESX account credentials, which is no go.
For ESX 4.1 and later it is "Virtual Machine.Interaction.Acquire Guest Control Ticket".
For ESX 4.0 and earlier it is "Virtual Machine.Interaction.Console Interaction".
Hello, Najtsob-
I was not aware of an issue like that in previous versions, but you can definitely use Invoke-VMScript with PowerCLI 4.1 U1 without using/passing any host username/password or host credentials. Example:
PS C:\> $credGuestCred = Get-Credential administrator
PS C:\> Invoke-VMScript -VM myVM -ScriptText "hostname.exe" -ScriptType bat -GuestCredential $credGuestCredmyVMPS C:\> ## yay!
This simple example first gets the guest credentials from the user, and then invokes "hostname.exe" to run on the given VM.
This example assumes that you are connected via Connect-VIServer to the vCenter server or to the host on which the VM resides. You also must be using PowerShell in 32bit mode (else you receive the telling error, "This cmdlet requires x86 architecture").
There was an issue in the pre-4.1U1 builds, where, depending on where you were connected (vCenter/ESX(I)), you had to pass the host credentials.
That is definitely gone in 4.1U
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Where can I get this latest and greatest 4.1 U1 version ? I need powershell cmdlets and C# api.
My current PowerCLI version is 4.1.0.2519 and Vmware.vim version is 4.1.0.0.
Use the Download button.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK, I found it here: http://www.vmware.com/support/developer/PowerCLI/index.html
I was confused because of release date.
I installed it and if I go to control panel I see new version number 4.1.1.2816, so I think upgrade went OK.
Then I tried example from mattboren and still got the same error as before the upgrade.
Invoke-VMScript : 1.7.2011 9:35:02 Invoke-VMScript While performing o
peration 'Open VM file '[LUN001] Dep/worker1.vmx'' the following e
rror occured: 'Insufficient permissions in host operating system'
At line:1 char:16
+ Invoke-VMScript <<<< -VM $VM -ScriptText "hostname.exe" -ScriptType bat -Gue
stCredential (get-Credential)
+ CategoryInfo : OperationStopped: (:) [Invoke-VMScript], VimExce
ption
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_VixWaitForJob_VixErr
or,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
I should add, that this is VM, which is part of the vmware view linkec-clone pool.
It looks as if the account you are using doesn't have access to the VMX file of the guest.
I don't know if View places any special permissions on the guest files I'm afraid.
Can you try with a non-VIew guest ?
Just to make sure the cmdlet works.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried several VM's and I allways get the same error.
So our esx admins configure some extra security and screwed up this cmdlet ?
Can some one please tell me what exact priviliges does vCenter users needs to use this cmdlet ?
For ESX 4.1 and later it is "Virtual Machine.Interaction.Acquire Guest Control Ticket".
For ESX 4.0 and earlier it is "Virtual Machine.Interaction.Console Interaction".
Thank you very much.