VMware Cloud Community
NYSDHCR
Enthusiast
Enthusiast

Scripting an ESX host shutdown using shutdown

I want to remotely shutdown an ESX host from a physical windows 2008 server using the plink and  "shutdown" command. This is what I have so far:

plink -ssh -t root@esx_ip_address -l druser -pw shutdown sudo shutdown -h

I have created a local user on the host called druser and he is in a group caller druser

I have created a line in the sudoers file:

%druser      ALL=(ALL)     NOPASSWD: /usr/bin/shutdown -h

After I run it, I am still prompted for a password.

Any assistance would be appreciated.

Reply
0 Kudos
6 Replies
DSTAVERT
Immortal
Immortal

You can try ssh passwordless keys. http://bkb.vmware.com/kb/1002866

-- David -- VMware Communities Moderator
Reply
0 Kudos
NYSDHCR
Enthusiast
Enthusiast

ssh has to be enabled for security purposes

Reply
0 Kudos
DSTAVERT
Immortal
Immortal

ssh has to be enabled for security purposes

I don't know that I understand your statement. I am suggesting that you look at using ssh keys rather than passwords. Have a look at putty keygen.

-- David -- VMware Communities Moderator
Reply
0 Kudos
AndreTheGiant
Immortal
Immortal

Use the full path of your command (/usr/bin/shutdown -h) as written in the sudoers file.

Andre

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
Reply
0 Kudos
bulletprooffool
Champion
Champion

Using PowerCli is easy . .

Have a look at
Alternatively, you could use IPMI to access your remote management cards?
(Or just shutdown as stated by Andre above)
One day I will virtualise myself . . .
Reply
0 Kudos
NYSDHCR
Enthusiast
Enthusiast

I tried that. It is still prompting me for a password.

Reply
0 Kudos