VMware Cloud Community
paulnye
Contributor
Contributor

Shutdown VMs & Esxi via command line with plink fails

I found a command which graciously shuts down my VMs then the ESXi host itself, via plink. The command is - /sbin/shutdown.sh && /sbin/poweroff

If I start a normal putty ssh session then manually issue the command it works perfectly. But if I run it via 'plink' (which logs in without requiring interaction) the command also appears to run fine and it shuts down the VMs perfectly, but for some reason it doesnt properly shut down the ESXi host, but instead the host is still pingable, but the terminal screen shows the ESXi status although when I press F2 I get an error 'direct console access has been disabled by the administrator' My only option then is to plug the power cord. Is it in some kind of maintenance mode instead?, or suspend? Why does it only do this when I run the command via plink?

Tags (3)
0 Kudos
1 Reply
Imranq
Enthusiast
Enthusiast

The exact same thing happened to me when i didn't specify ssh option in the plink command and also authenticated with a non root user account.

When i run this in the terminal it all worked fine:

plink -ssh -2 -pw Windows1 root@192.168.0.10 "/sbin/shutdown.sh && /sbin/poweroff"

0 Kudos