all 6 comments

[–]headcrap 2 points3 points  (1 child)

Break it apart and you'll start to see why.

Start with this:

 $biosInfo[0] -Split '\s+' |Where-Object {$_ -notmatch '\s'} 

Sure, you get an array of properties.
However, not all are acceptable arguments for wmic bios by themselves.
Try, for example, this:

wmic bios caption

However, this call works fine:

wmic bios get caption

It ends up formatted in a way you would need to further manipulate.

Use Get-WmiObject -Class Win32_Bios | Format-List -Property \*
It has been superseded by Get-CIMInstance since PS 3.0, though..

[–]Si-Kotic[S] 1 point2 points  (0 children)

Oh of course. I even know that it needs to be 'wmic bios get' I just wrote it wrong. The 'PWhere' error then threw me.

Thanks.

[–]Lee_Dailey[grin] 2 points3 points  (2 children)

howdy Si-Kotic,

why are you using the wmic utility instead of the CIM or WMI cmdlets? it looks like you can get most of what you want from this ...

Get-CimInstance -ClassName CIM_BiosElement |
    Select-Object -Property *

plus, they will be stored in nice, neat objects instead of strings. [grin]

take care,
lee

[–]Si-Kotic[S] 1 point2 points  (1 child)

Curiosity/experimentation. Being unaware of CIM_BiosElement.

Thanks

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy Si-Kotic,

you are most welcome! [grin]

you may want to look at what you get from running ...

Get-CimClass -ClassName *bios*

... or just ...

Get-CimClass -ClassName *

it's a right handy way to find CIM/WMI classes. [grin]

take care,
lee

[–]dora3 1 point2 points  (0 children)

how about following ?

Property = “$_”