MNEsther
Contributor
Contributor

Problem deleting snapshot via PowerCLI

Jump to solution

I can see the snapshot via command line, but not via the vSphere Client.

Unable to deleted said snapshot.

> Get-VM | Get-Snapshot | Select VM, Name, Created

VM                         Name                                 Created

sp3vtst                    Scheduled_Snapshot          6/11/2013 4:35:08 PM

Unable to remove it:

> Remove-Snapshot -Snapshot $Scheduled_Snapshot

Remove-Snapshot : Cannot validate argument on parameter 'Snapshot'. The

argument is null. Supply a non-null argument and try the command again.

At line:1 char:27

+ Remove-Snapshot -Snapshot $Scheduled_Snapshot

+                           ~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidData: (:) [Remove-Snapshot], ParameterBin

   dingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom

   ation.ViCore.Cmdlets.Commands.RemoveSnapshot

Obviously it is telling my my parameter $Scheduled_Snapshot is incorrect.

I have tried without the $, in double and single quotes,  na-da

Like I said, I do not see it in the client.  Could this be bogus information from the Get-VM command?

I have tried removing the vm from inventory, readding, create a snapshot and delete all from the client.  Not sure what to try next.

I have jobs setup to take snapshots before the Windows updates.  Now I would like to remove them via PowerCLI.

Thanks

D

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Try it like this

Get-VM -Name sp3vtst | Get-Snapshot -Name "Scheduled_Snapshot" | Remove-Snapshot -Confirm:$false


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership

Try it like this

Get-VM -Name sp3vtst | Get-Snapshot -Name "Scheduled_Snapshot" | Remove-Snapshot -Confirm:$false


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

0 Kudos
MNEsther
Contributor
Contributor

That did it!!  Yay!!

Thank you

0 Kudos
ganesh24pal
Contributor
Contributor

Thanks LucD,

its working for me.

======================================================================

PowerCLI C:\> Get-Snapshot -VM CentOS -Name 'snapshot1'

Name                 Description                    PowerState

----                 -----------                    ----------

snapshot1                                           PoweredOff

PowerCLI C:\> Get-VM |Get-Snapshot | select VM,Name, Created

VM                         Name                       Created

--                         ----                       -------

Win2k8-2nd                 Before                     4/15/2014 4:21:04 AM

CentOS                     BeforePatch                5/5/2014 5:45:57 AM

CentOS                     snpashot1                  5/5/2014 5:52:31 AM

CentOS                     snapshot1                  5/5/2014 5:55:53 AM

PowerCLI C:\> Get-VM -Name CentOS| Get-Snapshot -Name "snpashot1" | Remove-Snaps

hot -Confirm:$false

PowerCLI C:\>

====================================================================

0 Kudos