Renaming Object Properties in Powershell

by Jan 7, 2013

Let's say you want to output just your top-level processes like this:

PS> Get-Process | Where-Object { $_.MainWindowTitle } | Select-Object Name, Product, ID, MainWindowTitle 

This works like a charm, but you'd like to rename the column "MainWindowTitle" to "Title" only. That's what AliasProperties are for:

PS> Get-Process | Where-Object { $_.MainWindowTitle } | Add-Member -MemberType AliasProperty -Name Title -Value MainWindowTitle -PassThru | Select-Object Name, Product, ID, Title 

Twitter This Tip! ReTweet this Tip!