VMware Cloud Community
tdubb123
Expert
Expert

get-snaposhot with vcernter info

hi

any idea why I am not getting vcenter info here for this?

Screen Shot 2017-06-29 at 6.40.45 AM.png

Reply
0 Kudos
10 Replies
LucD
Leadership
Leadership

Not without you showing us what is in the Uid property :smileygrin:


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

Reply
0 Kudos
LucD
Leadership
Leadership

Seems to work perfectly for me

Get-VM | Get-Snapshot |

Select VM, Name,

    @{N="Size";E={"{0:N2} GB" -f ($_.SizeGB)}},

    Created, Description,

    @{N="vCenter";E={$_.Uid.Split(":")[0].Split("@")[1]}}


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

Reply
0 Kudos
tdubb123
Expert
Expert

luc

when I do

Get-VM | Get-Snapshot |

Select VM, Name,

    @{N="Size";E={"{0:N2} GB" -f ($_.SizeGB)}},

    Created, Description,

    @{N="vCenter";E={$_.Uid.Split(":")[0].Split("@")[1]}} | sort Created | ft -auto | out-file c:\scripts\snapshot.txt

its not showing the vcenter column

Reply
0 Kudos
tdubb123
Expert
Expert

ok I guess some of my Description columns were too long?

When I removed description, it does show the vcenter column.

any idea ?

Reply
0 Kudos
vijayrana968
Virtuoso
Virtuoso

Normal notepad editor wouldn't show full summary of output. You can try Export-Csv and check output in CSV file.

Reply
0 Kudos
LucD
Leadership
Leadership

So can you show us an example of how the Uid property in a Snapshot object looks like at your site.

You can block out the sensitive information that might be in there, I just need to see how the structure of the value is.


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

Reply
0 Kudos
LucD
Leadership
Leadership

Try like this

Get-VM | Get-Snapshot |

Select VM, Name,

    @{N="Size";E={"{0:N2} GB" -f ($_.SizeGB)}},

    Created, Description,

    @{N="vCenter";E={$_.Uid.Split(":")[0].Split("@")[1]}} | sort Created |

export-csv report.csv -NoTypeInformation -UseCulture


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

tdubb123
Expert
Expert

is this what you are asking for luc?

Reply
0 Kudos
vijayrana968
Virtuoso
Virtuoso

Give full file path something like this :

export-csv c:\reports\report.csv

Reply
0 Kudos
LucD
Leadership
Leadership

Yes, from what I can see that looks ok.

Is there a hostname or an IP address between the @ and the : ?


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

Reply
0 Kudos