Share via


Get-WmiObject returns property as an array?

Question

Thursday, September 1, 2016 5:09 PM

Hey everyone,

When I use Get-WmiObject the return is an array (I think?) even though I am only selecting one property.

$win32_obj = Get-WmiObject -Class win32_computersystem -ComputerName $status.IP  | select PSComputerName

The return is:

@{PSComputerName=<computername>}

I have attempted to trim the output but the .trim method doesn't seem to work on my $win32_obj variable.

Does anyone have any ideas?

Thanks in advance for your help. 

All replies (2)

Thursday, September 1, 2016 5:18 PM ✅Answered | 1 vote

$win32_obj = Get-WmiObject -Class win32_computersystem -ComputerName $status.IP  | select -EXPAND PSComputerName

\(ツ)_/


Thursday, September 1, 2016 5:23 PM

that worked thank you for helping me out.

and sorry for the silly question.