These pages cover SQL Clone Technical Preview 0.2 to 0.3, which is not the latest version. Help for other versions is also available.

Show-InstantCloneSnapshots

Show a list of snapshots.

Syntax

Show-InstantCloneSnapshots [<CommonParameters>]

Description

Produces a list of all of your snapshots, both local and shared. This is returned as a IEnumerable of DbSnapshot objects, so it can be used with PowerShell for advanced use cases, e.g. deleting all snapshots older than a month with no clones.

Parameters

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None.
    You cannot pipe input to this cmdlet.

Return values

The output type is the type of the objects that the cmdlet emits.

  • None.
    You cannot pipe input to this cmdlet.

Examples

---------- EXAMPLE 1 ----------

Show-InstantCloneSnapshots | Format-Table

This returns all your snapshots, formatted as a table

---------- EXAMPLE 2 ----------

Show-InstantCloneSnapshots | Where-Object { $_.SnapshotTime -lt "03/30/2016" -and $_.NumberOfClones -eq 0 } | ForEach-Object { Remove-InstantCloneSnapshot  -SnapshotName $_.Name }

This removes old unused snapshots. A filter is created for snapshots created before 30th March with no clones. These are then piped to Remove-InstantCloneSnapshot.

You cannot delete shared snapshots with this code. Either rerun with the -SharedSnapshot parameter, or adapt the filter.

  • No labels