RowlandoGloom Posted August 7, 2015 Posted August 7, 2015 I'm not sure whether anybody's interested, however I have a few problematic VMs which I don't want to rebuild. Every now and then Windows gets messed up and I have to restore it from a checkpoint. I've created a powershell script which runs on the Hyper-V host as a scheduled task to backup the VMs every morning. This will run whether the VM is powered on or off, but not suspended. function backup([string]$virtualMachine) { # Assemble VM Details $virtualMachineDetails= Get-VM -ComputerName $HyperVHost -Name $VirtualMachine Write-Host "Creating snapshot of $virtualMachine" $dateDisplayFormat = Get-Date -Format yyyy.MM.dd $timeDisplayFormat = Get-Date -Format HH.mm.ss $snapshotName = $virtualMachineDetails.Name + ": " + $dateDisplayFormat + " " + $timeDisplayFormat CheckPoint-VM -ComputerName $HyperVHost -Name $virtualMachine -Snapshotname $snapshotName Write-Host "Snapshot of $virtualMachine complete" } $HyperVHost = "hostname.domain.loc" backup -virtualMachine "VirtualMachineName1" backup -virtualMachine "Some Other Virtual Machine" backup -virtualMachine "And maybe a third" Obviously replace the bottom 4 lines with your own details. Save it as c:\createCheckpoints.ps1 In task scheduler, create a task to run "powershell.exe" and in the arguments add "-File c:\createCheckpoints.ps1". Make sure the task is set to run whether there's a user logged on or not. This will create a checkpoint every time the script runs so I don't forget to. I'm going to add a bit in to get rid of snapshots over * days old, but will stick with manually deleting the, for now. 1
RowlandoGloom Posted August 7, 2015 Author Posted August 7, 2015 VMs starting up to a black screen occasionally when they're rebooted: http://www.edugeek.net/forums/windows-server-2012/157235-black-logon-screen.html#post1350942
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now