?
Solved

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

Posted on 2008-10-27
9
Medium Priority
?
7,886 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 4

Accepted Solution

by:
bmonroe44 earned 210 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 180 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Assisted Solution

by:hilmarusd
hilmarusd earned 180 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 180 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This video shows you how to use a vSphere client to connect to your ESX host as the root user. Demonstrates the basic connection of bypassing certification set up. Demonstrates how to access the traditional view to begin managing your virtual mac…
Suggested Courses

764 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