Just getting started with Powershell and have a quick question. Trying to run this statement:
gwmi -query "select Description from Win32_OperatingSystem" | select-object Description
The results come back as:
Description
------------
My PC Name
But I just want MY PC Name. What else to I need to add to the statement to remove the label and just get the value? Thanks!
Your output is going through (Format-Default and then) Format-Table, which adds that header. You can get rid of it by specifying
Format-Table -HideTableHeaders…OR … if you really just want the string, you can use any of these patterns: