#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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.