Search code examples
powershellhyper-vcheckpoint

Scripting VM checkpoint in SCVMM via Powershell


Thought this would be a no brainer, but I couldn't find this question in here.

Having trouble getting a simple powershell script to work for creating a checkpoint. It appears to complete successfully but I'm not seeing a checkpoint in SCVMM so I'm wondering if I'm missing something here.

Import-Module -Name "virtualmachinemanager"
Get-VMMServer SCVMMSERVER01.CORP.COM
Checkpoint-VM -Name Create-Checkpoint -AsJob -ComputerName COMPUTER001 -SnapshotName "Deployment-$((Get-Date).toshortdatestring())"

Thanks


Solution

  • Why not use SCVMM cmdlet New-SCVMCheckpoint?

    Get-SCVirtualMachine -Name 'VM01' | New-SCVMCheckpoint
    

    or

    New-SCVMCheckpoint -VM 'VM01'
    

    When I tried to use the Hyper-V cmdlet on an SCVMM VM I got an error

    Cannot convert value of type SystemCenter.VirtualMachineManager.VM to HyperV.PowerShell.VirtualMachine.