Microsoft Virtualization Discussions

How to store a value of output result in a variable?

AllenChang
1,154 Views

I  want to store a output result in a variable

for example

I use the command

PS C:\Users\Administrator> $vol0size = Get-NcVol vol0 | Format-Table {$_.TotalSize/1GB}
PS C:\Users\Administrator> Write $vol0size

$_.TotalSize/1GB
----------------
86.81876373291015625

 

I want to store the result (86.81876373291015625) in variable (for examble $vol0size)

but it always store all the result not only 86.81876373291015625

How to make the result just only 86.81876373291015625 ?

 

 

 

 

1 REPLY 1

hmoubara
1,042 Views

Hello @AllenChang 

 

You should be able to add -HideTableHeaders into the command.

Per example:

$vol0size = Get-NcVol vol0 | Format-Table {$_.TotalSize/1GB} -HideTableHeaders

 

Thanks 

Public