VMware Scheduled Snapshot Creation in a Task, Fully Automated
In this article we describe how to schedule a VMware snapshot in a task so that the snapshot creation is fully automated. This can be achieved very easily with just one command in the Windows Task Scheduler:
Create a batch file with the command:
vmrun -T ws snapshot "c:\virtualmachines\windows2019.vmx" mySnapshot
Replace the VMX path with your VM’s path and name the snapshot as you like.
The vmrun tool ships with all VMware products. In the case of VMware Workstation it’s in the path C:\Program Files (x86)\VMware\VMware Workstation. Don’t forget the quotes if you are dealing with paths that contain spaces.
To add the date and time to the snapshot name, try this instead:
set CUR_YYYY=%date:~10,4% set CUR_MM=%date:~4,2% set CUR_DD=%date:~7,2% set CUR_HH=%time:~0,2% if %CUR_HH% lss 10 (set CUR_HH=0%time:~1,1%) set CUR_NN=%time:~3,2% set CUR_SS=%time:~6,2% set CUR_MS=%time:~9,2% set SNAPSHOTFILENAME=%CUR_YYYY%%CUR_MM%%CUR_DD%-%CUR_HH%%CUR_NN%%CUR_SS% vmrun -T ws snapshot "c:\virtualmachines\windows2019.vmx" %SNAPSHOTFILENAME%
Simply store those commands in a .bat and schedule it to run in the Windows Task Manager:
- Press the Windows logo key + R, type taskschd.msc and press Enter.
- On the Actions panel, click Create Basic Task
- Go through the steps
- When prompted, select “Start a program” as the task’s action, and click Next.
- In the textbox labeled “Program/script”, enter the full path to the batch file
- Click Next.
- Click Finish.
Make sure that you use the same Windows User in the Task Scheduler settings as the user that runs the VMware VM. Otherwise the vmrun tool won’t run.
See this page on how to set up the Task Scheduler to run a batch file: https://www.thewindowsclub.com/how-to-schedule-batch-file-run-automatically-windows-7
Backing up VMware
Is your backup for VMware automated? Download BackupChain’s automatic backup software today, it contains VMware Backup and much more and installs in just a minute!
Backup Software Overview
Server Backup SoftwareDownload BackupChain
Cloud Backup
Backup VMware Workstation
Backup FTP
Backup VirtualBox
Backup File Server
Hyper-V Backup
Backup Hyper-VPopular
- Hyper-V Links, Guides, Tutorials & Comparisons
- Veeam Alternative
- How to Back up Cluster Shared Volumes
- DriveMaker: Map FTP, SFTP, S3 Site to a Drive Letter (Freeware)
Resources
- Free Hyper-V Server
- Remote Desktop Services Blog
- SCDPM Blog
- SCOM Blog
- V4 Articles
- Knowledge Base
- FAQ
- Archive 2024
- Archive 2022
- Archive 2021
- Archive 2020
- Archive 2018
- Archive 2017
- Archive 2016
- Archive 2015
- Archive 2014
- Archive 2013
- Hyper-V Scripts in PowerShell
- FastNeuron
- BackupChain (Greek)
- BackupChain (Deutsch)
- BackupChain (Spanish)
- BackupChain (French)
- BackupChain (Dutch)
- BackupChain (Italian)
Backup Software List
BackupChain
Veeam
Unitrends
Symantec Backup Exec
BackupAssist
Acronis
Zetta
Altaro
Windows Server Backup
Microsoft DPM
Ahsay
CommVault
IBM
Other Backup How-To Guides
- Before You Use Carbonite, Mozy, CrashPlan, Rackspace, Softlayer
- Windows Server 2012 R2 New Features & What’s New in Server 2012 R2
- Best Free Network Attached Storage for Files, Hyper-V, and Backups
- 2 Reasons Why Continuous Data Protection (CDP) Isn’t Always A Good Idea for Backups
- How to Convert VHD Files to VHDX Disks in Hyper-V
- Windows 8 Client Hyper-V Limitations, Intro, and Pitfalls
- Hyper-V Integration Services Update: Why You Need to Keep Them Up-to-Date at all Times
- Incremental Backup vs. Differential Backup
- How to fix error CLSID {463948d2-035d-4d1d-9bfc-473fece07dab} Access Denied
- How to Convert from Dynamic VHD/VHDX Disk Format to / from Fixed in Hyper-V
- Windows Server 2019 ISO Free Download + Hyper-V Server 2019
- Hyper-V CSV backup: What needs to be considered for VM backups?
- Hyper-V Server 2016 Download Locations + 2012 R2, 2008
- 11 Things to Know About Hyper-V Snapshots / Checkpoints
- Free eBooks for Hyper-V and Windows Server Admins
- Reboot a virtual machine in Hyper-V from the command line
- Hyper-V, VMware, VirtualBox Feature Comparison
- How to Fix: Folder name too long to delete
- KB 2885465: CPU resources are not allocated correctly for VMs on Windows Server 2012
- 0x800705aa How to Fix ERROR NO SYSTEM RESOURCES