Using PropertySets

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

PropertySets are lists of properties, and PowerShell sometimes adds PropertySets to result objects to make picking the right information easier. Get-Process for example returns process objects, and these contain two PropertySets:

PS> Get-Process | Get-Member -MemberType PropertySet

   TypeName: System.Diagnostics.Process

Name            MemberType  Definition
----            ----------  ----------
PSConfiguration PropertySet PSConfiguration {Name, Id, PriorityClass, FileVersion}
PSResources     PropertySet PSResources {Name, Id, Handlecount, WorkingSet, NonPagedMe...

If you're interested in process configuration, you can use the PropertySet PSConfiguration to display the typical process properties Name, Id, PriorityClass, and FileVersion. If you rather want to keep an eye on process resources, use the PropertySet PSResources instead:

PS> Get-Process | Select-Object -Property PSConfiguration
PS> Get-Process | Select-Object -Property PSResources

Note that in PowerShell 3.0, the parameter -Property supports auto-completion, so just enter "PS" and then press TAB to see all properties that start with "PS".

Twitter This Tip! ReTweet this Tip!


Posted Jan 24 2013, 06:00 AM by ps1
Copyright 2012 PowerShell.com. All rights reserved.