#Powershell and Select

Just wanted to share this with you.  Was playing with PowerShell the other day, like you do and discovered this.

Say you run Get-Process and you use the select option to choose the heading:

PS C:\PS> Get-Process zune* | select ProcessName, id

ProcessName                                                                                                          Id
———–                                                                                                          —
ZuneLauncher                                                                                                       2412

Did you know you can use an array in the select command? Neither did I!

PS C:\PS> $x=”ProcessName”,”id”
PS C:\PS> Get-Process zune* | select $x

ProcessName                                                                                                          Id
———–                                                                                                          —
ZuneLauncher                                                                                                       2412

How kewl is that?!

Leave a Reply

%d bloggers like this: