trying to create a snaphot using powershell and powerCLI
connect-viserver -server 10.30.7.106 -user root -password password
$vm = Get-VM
New-Snapshot -Name Target-Snpsht -VM ($vm)
this works fine but I would like to be able to commit the snapshot from powerCLI?
Any ideas on the commands?
If you mean reverting a guest to a snapshot, you can do this:
Set-VM -VM <VMname> -Snapshot (Get-Snapshot -VM <VMname> -Name <SnapshotName>) -confirm:$FALSE
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So if I take a snapshot of a VM called snapshot1
Take a backup of the flat vdmk file to a new location
The I wont to commitee the snapshop against the original VM flat vdmk file to account for the changes since the snapshot was created.
I dont wont to loose the changes.
Example
connect-viserver -server 10.30.7.106 -user root -password password
$VMs = Get-VM -Location ( Get-ResourcePool pool1 )
foreach ( $vm in $VMs ) { Set-VM -VM $vm -Snapshot ( Get-Snapshot -VM $vm -Name Target-Snpsht ) }
If I understand you correctly, you want to "commit" the snapshot you took before.
And all the changes made to the guest should be written to the disk.
In that case you could do
Get-Vm <VMname> | Get-Snapshot -Name <SnapshotName> | Remove-Snapshot -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If I understand you correctly, you want to "commit" the snapshot you took before.
And all the changes made to the guest should be written to the disk.
In that case you could do
> Get-Vm <VMname> | Get-Snapshot -Name <SnapshotName> | Remove-Snapshot -Confirm:$false >
Pretty much yes.
Trying to create a cold disastery recovery for a client.
Simply need to take a snapshot of 1-6 VMs one at a time
then copy the vmdk-flat file to another backup datastore
Once the copy is completed commit the snapshot to ensure any change is written to the base vmdk file
Issue now is to copy via I guess ssh to another standalone vSphere server at a new location.
I am guessing I need to copy to a backup datastore to reduce the time the snapshot runs for.
Copying via ssh is slow to another datastor, is there a quicker way?
See your other thread where I mentioned FastScp from Veeam.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD.
You were so very helpful with me on finding my issue on the Cloning Issue a while back, I wanted to ask if you could explain how to "Delete" a snapshot without having the changes move back to the parent. I want to simply revert or go to the parent, then get rid of all the other snapshots.
Thanks.
Tim
To remove all snapshots without merging the snapshot data into the original VMDK, you can use the RemoveAllSnapshots_Task method.
The consolidate parameter allows you to define what needs to happen with the snapshot data.
In your case, you would use $false to avoid merging the snapshot data with the original VMDK.
$vm = Get-VM MyVM
$vm.ExtensionData.RemoveAllSnapshots($false)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference