VMware Cloud Community
madhanSakthi
Contributor
Contributor

Invoke-vmscript authentication failure

HI,

   Im facing an issue with the Invoke-VMscript command.The authentication is failing even though the credentials are correct. I couldnt find a proper reason for this failure.

Is there any particular reason for this ?

error.jpg

Thanks in advance

Reply
0 Kudos
7 Replies
DZ1
Hot Shot
Hot Shot

Try single quotes for the username and password.

Reply
0 Kudos
madhanSakthi
Contributor
Contributor

It dint help. Is there any prerequisite to access the script in the guest vm ?

Reply
0 Kudos
MKguy
Virtuoso
Virtuoso

Please answer/review each of the following items:

1. Are you trying to call a script that is stored locally on the target GuestOS, or stored locally on your PowerCLI machine?

2. Can you execute single-commands? I.e. try -ScriptText 'ipconfig'

3. Is the "vmadmin" account a domain or a local OS account? If a domain account, use "domain\vmadmin", if it's a local account, use ".\vmadmin"

4. The vmadmin account MUST be in the local administrators group of the target Guest. Have you double-checked this?

5. Can you logon with the vmadmin account to the GuestOS via RDP or locally and try some administrative task?

6. Does the user account you run PowerCLI with have read access to the folder containing the virtual machine and  the Virtual Machine.Interaction.Console Interaction privilege?

There are a couple of requirements you need to fulfill to use Invoke-VMScript. Check the documentation:

http://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.powercli.cmdletref.doc%2FInvoke-VMSc...

To run Invoke-VMScript, the user must have read access to the folder containing the virtual machine and a Virtual Machine.Interaction.Console Interaction privilege. The virtual machines must be powered on and have VMware Tools installed. Network connectivity to the ESX system hosting the virtual machine on port 902 must be present. To authenticate with the host or the guest OS, one of the HostUser/HostPassword (GuestUser/GuestPassword) pair and HostCredential (GuestCredential) parameters must be provided. The guest account you use to authenticate with the guest operating system must have administrator's privileges.

Also run this test script which will check some prerequisites:

http://www.lucd.info/2012/01/01/will-invoke-vmscript-work/

-- http://alpacapowered.wordpress.com
Reply
0 Kudos
madhanSakthi
Contributor
Contributor

I was able to run ipconfig command. I gave the same permission to vm.bat file as ipconfig.exe application. I was able to access ipconfig.exe, but not vm.bat file

The path couldnt be found.

x.jpg

Reply
0 Kudos
MKguy
Virtuoso
Virtuoso

Good job ignoring most of the questions I specifically asked to go through.

Anyways, I'm pretty sure it won't be able to find the path from your screenshot that is "c\x\vm.bat".

-- http://alpacapowered.wordpress.com
Reply
0 Kudos
madhanSakthi
Contributor
Contributor

well, i have already checked all the prerequisite u ve mentioned.All these requirements are there in the VM. I just want to highlight that the ipconfig.exe is accessible,

hence something else is needed to access the user created file like vm.bat.

Reply
0 Kudos
DZ1
Hot Shot
Hot Shot

You may be running something that requires permission elevation.  I've run into that many times.