reverting to a clean VM from ESX console

Is there a way to remote into the esx console via ssh and revert/start a VM. trying to do this via a script.

Who is Participating?
Andrew Hancock (VMware vExpert / EE MVE^2)Connect With a Mentor VMware and Virtualization ConsultantCommented:
There are PowerCLI commandlets for starting, stopping, restarting and suspending virtual machines – Start-VM, Stop-VM, Suspend-VM, Stop-VM. The follow examples show how to use some of them:

# filtering machines by name and start those that are not started
Get-VM <name-filter> | where { $_.PowerState –eq "PoweredOff" } | Start-VM

# stopping virtual machine, defining that we do not want to confirm
# each stop operation
Get-VM <name-filter> | Stop-VM –confirm:$false

I would recommend using the following, also VMware recommends the use of PowerCLI, which is PowerShell interface with vSphere-specific additions.

One of the simplest PowerCLI examples, and something which is actually extremely useful on its own, is the Get-VM cmdlet. Which lists VMs.

PowerCLI can be a bit overwhelming to use,  But it can be enhanced with a nice toolset and a library of preconfigured scripts to jump-start your mass changes, which is possible with PowerGUI


VMware Community Pack

It's also worth looking at The free VMware Guest Console

The free VMware Guest Console, an experimental application created by VMware Labs, is a great tool for managing vSphere VM processes and files. You can view, sort and kill processes across all VMs, and you can also run a script on all Windows or Linux VMs.

If you do want a script, LucD (1 of *the* premier PowerCLI gurus; literally co-wrote the book on PowerCLI :) ) provides a script in the following link:
Brian HarringtonIT ManagerCommented:
Do you have vcenter?  If you have vcenter you can do it through the powershell kit.
progjmAuthor Commented:
One of the servers yes, but not the other
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Brian HarringtonIT ManagerCommented:
what do you mean, on one but not the other, are we talking about two different locations, or are you using the free version?
progjmAuthor Commented:
@bharrington83 yes they are two seperate boxes (one connected to VCenter and one not), located on different networks. Neither are free versions

thanks hanccocka, let me check if these will work
Brian HarringtonConnect With a Mentor IT ManagerCommented:
You can use the PowerCLI direct to an esxi server, it's just advantageous to use vcenter. As far as reverting goes, you'll need to have a snapshot running all the time,  then to revert, just revert the snapshot.
progjmAuthor Commented:
thank you both, worked like a charm
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.