VMware Cloud Community
COS
Expert
Expert
Jump to solution

long datastore names truncated after Get-Datastore

When I run the command below...

Get-Cluster yomama | Get-Datastore | Sort-Object -Property FreeSpaceGB -Descending  | Format-Table -HideTableHeaders

The output is truncated then appended with a "…"

esx-somebody-made-long-name...

The actual name is

esx-somebody-made-long-name-for-the-hell-of-it

Looks like if more than 29 or 30 characters it does this.

What's the command to output the full name?

Thanks

Reply
0 Kudos
25 Replies
COS
Expert
Expert
Jump to solution

I had high hopes for this one but I got this....

pastedImage_1.png

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Btw, you can reset that default behaviour by using the Out-Default cmdlet.

For example

Get-Datastore -Name esx* | Select Name, FreeSpaceMB, FreespaceGB, CapacityMB, CapacityGB | Out-Default

Get-Datastore -Name esx* | Sort-Object -Property FreeSpaceGB -Descending | Select @{N = 'Name'; E = {"{0}" -f $_.Name}}, FreeSpaceGB, CapacityGB

will produce

dslist3.jpg


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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

There is no VMware.PowerCLI module in 6.5 R1, that only appeared in 6.5.1 (which is not the same as 6.5 R1)


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

Reply
0 Kudos
alleninbroomfie
Contributor
Contributor
Jump to solution

Yep, sorry mate-- I guess we're running different versions of vSphere and the PowerCLI.

This is craziness, LucD… good find.

He can fix it by adding a simple pipe at the end:

| Format-Table

And it will make it a table again.

Get-Datastore -Name esx* | Select Name, FreeSpaceMB, FreespaceGB, CapacityMB, CapacityGB

Get-Datastore -Name esx* | Sort-Object -Property FreeSpaceGB -Descending | Select @{N = 'Name'; E = {"{0}" -f $_.Name}}, FreeSpaceGB, CapacityGB | Format-Table

Reply
0 Kudos
COS
Expert
Expert
Jump to solution

Adding " | Out-Default" to the end fixed it across all execution methods including from within my VB .Net App.

Thanks again!!!

Reply
0 Kudos
alleninbroomfie
Contributor
Contributor
Jump to solution

Yes, it's like writing HTML for different browsers... you think it's perfect and somebody opens up your webpage in Opera or old IE 7 and suddenly it looks like trash.  Dealing with different execution methods can be quite a headache... yes, that was a strange issue and a good find by LucD that with 5 properties it would change how it would format subsequent output... strange.  Glad it's fixed!

Reply
0 Kudos