PowerTip: Change Output Object Property Names with PowerShell

Summary: Use Windows PowerShell to change output object property names.

Hey, Scripting Guy! Question How can I use Windows PowerShell to change the property names of my output objects?

Hey, Scripting Guy! Answer The easiest way to achieve this to use Select-Object and a calculated field:

Get-WmiObject -Class win32_OperatingSystem -ComputerName webr201 |

select @{N=’ComputerName’; E={$_.PSComputerName}},

@{N=’OS’; E={$_.caption}},

@{N=’SP’; E={$_.ServicePackMajorVersion}}

Comments (0)

Skip to main content