1

I unable to see data of a column of a variable in Powershell.

I have dumped the result of a command Get-AzVMUsage -Location WestUS2 to a variable $Data.

Now, when I select the 4 columns that result from the variable $Data, I'm not able to see accurate of one of the column "Name".

$Data = Get-AzVMUsage -Location $Location
$Data | select Name,CurrentValue,Limit,Unit

Below is the attached output that I'm getting. in which the column "Name" is having same weird values. Output

mklement0
  • 382,024
  • 64
  • 607
  • 775
Vinny
  • 461
  • 1
  • 5
  • 18

1 Answers1

2

The .Name property of the objects output by Get-AzVMUsage cmdlet is of type UsageName.

When this property is stringified for display, it uses only the type name, which is unhelpful.

To get meaningful output, you either have to access the .Value or .LocalizedValue property, and in order to do so you must use a calculated property; e.g.:

$Data | select @{ n='Name'; e={ $_.Name.Value } }, CurrentValue, Limit, Unit
mklement0
  • 382,024
  • 64
  • 607
  • 775