VMware Cloud Community
MirkoB_
Contributor
Contributor
Jump to solution

error connecting to server from hostops.pl script

Hi at all,

i've got a esxi 4 server running a vMA VM.

I'm trying to shutdown host with a hostops.pl script

I use this syntax:

hostops.pl --host FQDN --operation shutdown

I insert username and password, but the script return this error:

Error connecting to server at 'https://localhost/sdk/webService': Connection refused

I have also tried with this syntax:

hostops.pl --host FQDN --url https://FQDN/sdk/webservice --operation shutdown --host_username root --host_password password, but the script return this error:

Cannot complete login due to an incorrect user name or password (the username and the password are certainly correct)

Why?

Thank you

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

vifpinit will only work if you've actually added a target into vMA's fastpass management system. To do so, you'll need to use vifp, please refer to the vMA documentation for further information. Regarding your hostops.pl syntax, you should be using --server , as you can see from the error you're specifying the wrong flag and it's thinking you're trying to connect to "localhost" which is probably not where your ESX(i) server is located at.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
4 Replies
dessyboy
Contributor
Contributor
Jump to solution

Did you ever get this resolved? I have the same issue.

0 Kudos
TrooperX
Enthusiast
Enthusiast
Jump to solution

If you intiate the following then the error will be resolved.

Initialize vi‐fastpass:

*

vifpinit <targetserver>

*

If there is only one target server, you do not have to specify it.

Then Verify that you can run a vSphere CLI command without authentication by running a command on one

of the ESX/ESXi hosts, for example:

*

vicfg-nics -l --vihost <esx_host>

*

The command completes without prompting for authentication information. At this point run your VMA as your are expected

0 Kudos
dessyboy
Contributor
Contributor
Jump to solution

Tried it and got "No Target found"

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

vifpinit will only work if you've actually added a target into vMA's fastpass management system. To do so, you'll need to use vifp, please refer to the vMA documentation for further information. Regarding your hostops.pl syntax, you should be using --server , as you can see from the error you're specifying the wrong flag and it's thinking you're trying to connect to "localhost" which is probably not where your ESX(i) server is located at.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos