here are the virtual machines I have running:
vmware ESXi
** and
vmware workstation
* Is it possible to revert to snapshot using *. I've tried searching for an answer but all solutions involve reverting from the outside (either on some other machine or the host itself) - I can't find a workaround.
power off
* I would like to execute the script from within the guest, not from the host. Is there any way to achieve this? I am using VMWare tools inside the guest to update its configurations, so I am sure it should be possible for this software to execute scripts inside of guests. Implementation of this functionality would be great as new feature!
Under the VMware Tools section, there is a PowerCLI (command line interface) and I've done it recently. I should try this:
Connect-VIServer <vCenter Server IP>
Set-VM <VM name> -Snapshot <Snapshot name> -Confirm:$false
* This script will revert your VM to the given snapshot, and save it as a 'snapshot.csv'. You can use Windows Task Scheduler to automatically launch it.
Instructions:
1) Save the following code in a file called "revert_to_snapshot.ps1" (using PowerShell's generated extension), and make sure there is no extension: create a new tasks with task scheduler, and under 'program/script', enter the following command:
2) go into
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
* In the 'Add arguments' section you'll specify the location of your script.
-psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" "<path to your script>"
NOTE: vim.psc1 is not available in the latest version of PowerCLI. You can use this tip to test out what will happen if you try running it when vim.psc1 is deleted or unavailable, but you should wait before saving any changes.