Using PropertySets

by Jan 24, 2013

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!