Solved

Can I shutdown/startup a VM from a command prompt?

Posted on 2008-10-27
9
7,858 Views
Last Modified: 2012-05-05
I want to be able to shutdown and startup virtual machines on my ESXi server from another VM on the same server.
Obviously shutting down is easy enough.  But can I issue a command (automatically from a script) to the ESXi Host that starts up a VM hosted on it?  (Using only the free version of ESXi)
0
Comment
Question by:touch-base
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 4

Accepted Solution

by:
bmonroe44 earned 70 total points
ID: 22815124
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx stop trysoft
vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx stop hard
0
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 60 total points
ID: 22815321
there is a command that comes with vmware server, not sure about ESXi

The following command will start the virtual machine named ScriptStart1:

vmrun -T server -h https://dhcp-122:8333/sdk -u root -p rootpass start [standard] ScripitStartVM1/ScriptStartVM1.vmx

the vmrun is a exe in the vmware program files folder.

Hope this helps
0
 
LVL 4

Expert Comment

by:bmonroe44
ID: 22815415
I neglected to say that with the free version of ESXi you will not be able to make a script as the command appliance is read-only. You can however issue commands through it to shutdown a VM as described above.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Assisted Solution

by:hilmarusd
hilmarusd earned 60 total points
ID: 22817343
If you're using VMWare Server 2.0 (free version) on a windows server host, you can use the following:

C:\Program Files\VMware\VMware Server>vmrun -T server -h https://localhost:8333/sdk -u myusername -p mypassword stop "C:\Virtual Machines\ServerName\ServerName.vm"

Just make sure you have the right permissions for the username you specify or you'll get "Error: Insufficient permissions in host operating system."
0
 
LVL 16

Assisted Solution

by:Bryan Butler
Bryan Butler earned 60 total points
ID: 22818652
And to shut it down, I guess you would send the "shutdown" command.  So in powershell, that would be:

& "C:\Program Files\VMware\VMware Workstation\vmrun" -gu user -gp password runProgramInGuest "C:\VMs\Virtual Machines\VM177VistaBizBase\Windows Vista.vmx" C:\Windows\System32\shutdown

If you were running local.  I guess the -T and stuff if not.  Does that work?
0
 
LVL 1

Expert Comment

by:hilmarusd
ID: 22832644
I need to update my previous statement as that command line is invalid.  Here is the appropriate command line to start, stop, suspend, etc. a virtual server host in VMWare Server 2.0:

C:\Program Files\VMware\VMware Workstation\vmrun -T server -h https://localhost:8333/sdk -u myusername -p mypassword start "[standard] Coyote/Coyote.vmx"

Note that you need to put the storage device in square brackets before the name/vmxname.vmx.  Normally it's [standard] unless you're using a special storage device.  Also note the forward slash between virtual server name and the vmx filename instead of a back slash.
0
 
LVL 1

Author Closing Comment

by:touch-base
ID: 31510437
Thx guys - splitting points here best I can
0
 
LVL 1

Author Comment

by:touch-base
ID: 23052696
Thx guys

I also found this article helpful (for shuttng down the host)

http://communities.vmware.com/message/949876#949876
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 23053486
Thanks for the points, question, and excellent link.  
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Teach the user how to edit .vmx files to add advanced configuration options Open vSphere Web Client: Edit Settings for a VM: Choose VM Options -> Advanced: Add Configuration Parameters:
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question