VMware Cloud Community
fborges555
Enthusiast
Enthusiast
Jump to solution

Remove snapshot one by one

HI gurus

 

I have the remove-snapshot done but sometimes the vm has more than 2 Snapshots, how do I go and write my script to wait for one snapshot to be done before starting the next one.

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Isn't the standard sequence already doing that?
The snapshots are passed one-by-one through the pipeline to the Remove-Snapshot cmdlet.
And the pipeline only continues when the Remove-Snapshot is completed, as long as you don't use the RunAsync switch.

Get-VM -Name 'MyVM' |
Get-Snapshot |
Remove-Snapshot -Confirm:$false


 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Isn't the standard sequence already doing that?
The snapshots are passed one-by-one through the pipeline to the Remove-Snapshot cmdlet.
And the pipeline only continues when the Remove-Snapshot is completed, as long as you don't use the RunAsync switch.

Get-VM -Name 'MyVM' |
Get-Snapshot |
Remove-Snapshot -Confirm:$false


 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

LucD

 

Thanks a bunch, that is the part I did not know if the process did one by one.

 

Thanks a bunch again

Reply
0 Kudos