Microsoft Virtualization Discussions

Get full name of snapshot from Get-NaSnapshot

edwtechnology
3,265 Views

Hi, I appologise in advance if this is a newby question, but I am trying to get a list of snapshot names from a volume.

using Get-NaSnapshot gives me this list, but the snapshotnames are truncated and end in three dots. I would like to discover how to get at the full names without resorting to SSH

Background : We were using SMVI to create, restore and delete snapshots for a series of VMWare guests - this has the unfortunate side effect of inflating the snapshot to full size if we ever go back to one, so we are having to revert to doing snaprestores and managing the VMWare side ourselves. This is all driven by scripts in the back end, as the end users who need to take and restore the snapshots are non-technical.

There is an SMVI command in perl that gets the snapshot list and has the whole filename, I have been told I need to convert to PowerShell to use snaprestore and the snapshot list does not quite fit what I need (I store info in the snapshot names)

Example output:-

PS C:\Users\vCAdmin> Get-NaSnapshot -TargetName T15

Name                                               Created      Total Cumulative Dependency

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

smvi__T15_125-0_real20111220092221_b201112...   20/12/2011 362.0 MB    71.2 GB

smvi__T15_125-0_real20111220101708_b201112...   20/12/2011 61.0 GB    70.9 GB busy,LUNs

smvi__T15_125-1_real20111221151152_b201112...   21/12/2011     9.9 GB 9.9 GB

The full name would be more like

smvi__T15_125-1_real20111221151152_b20111208_env20111221151152_operatorsname

I'm sure there is a very quick solution to this, that escapes me - the documentation provided by our consultant was brief, and google has not revealed any hints.

1 ACCEPTED SOLUTION

edwtechnology
3,265 Views

Always the way - I find the answer after posting the question...

PS C:\Users\vCAdmin> Get-NaSnapshot T15 | select Name | ft -AutoSize

Name

----

smvi__T15_125-0_real20111220092221_b20111214_env20110901190108_aperson_20111220092245

smvi__T15_125-0_real20111220101708_b20111216_env20110901195555_aperson_20111220101747

smvi__T15_125-1_real20111221151152_b20111221_env20110901192403_aperson_20111221151201

View solution in original post

2 REPLIES 2

edwtechnology
3,266 Views

Always the way - I find the answer after posting the question...

PS C:\Users\vCAdmin> Get-NaSnapshot T15 | select Name | ft -AutoSize

Name

----

smvi__T15_125-0_real20111220092221_b20111214_env20110901190108_aperson_20111220092245

smvi__T15_125-0_real20111220101708_b20111216_env20110901195555_aperson_20111220101747

smvi__T15_125-1_real20111221151152_b20111221_env20110901192403_aperson_20111221151201

sizemore
3,265 Views

I'm glad you figgured it out, just a quick tip, you could also have used the ExpandProperty parameter on select-object.

PS C:\Users\vCAdmin> Get-NaSnapshot T15 | Select-Object -ExpandProperty Name

    

smvi__T15_125-0_real20111220092221_b20111214_env20110901190108_aperson_20111220092245

smvi__T15_125-0_real20111220101708_b20111216_env20110901195555_aperson_20111220101747

smvi__T15_125-1_real20111221151152_b20111221_env20110901192403_aperson_20111221151201

~Glenn

Public