Last active
August 29, 2015 14:17
-
-
Save carlessanagustin/eb6387e788e23b7ca350 to your computer and use it in GitHub Desktop.
Working with Hyper-V & Snapshots/Checkpoints via PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- VM --- | |
## get hyper-v info | |
Get-VMHost -ComputerName computer_name | format-list * | |
#3 get VMs info | |
Get-VM -ComputerName computer_name | |
## get VM info | |
Get-VM -ComputerName computer_name -name vm_name | |
##start/stop | |
Stop-vm -name vm_name | |
Start-vm -name vm_name | |
## import VM | |
Import-VM -Path 'D:\Test\Virtual Machines\xxxxxxx-xxx.XML' –Copy -GenerateNewId | |
## export VM | |
Export-VM –Name vm_name –Path 'D:\Test\Virtual Machines\' | |
# --- Snapshots/Checkpoints --- | |
## create snapshot | |
Checkpoint-VM -ComputerName computer_name -VMName vm_name -SnapshotName "my first snapshot" | |
## list snapshots | |
Get-VMSnapshot -ComputerName computer_name -VMName vm_name | |
## restore snapshot | |
Restore-VMSnapshot -ComputerName computer_name -VMName vm_name -Name "my first snapshot" -Confirm:$false | |
## remove snapshop | |
Remove-VMSnapshot -ComputerName computer_name -VMName vm_name -Name * | |
## export snapshop | |
Export-VMSnapshot –Name 'Base Image' –VMName vm_name –Path 'D:\Test\Virtual Machines\' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment