top of page

PowerShell Parameter -Property -Properties

A good example of the use of the -property switch is the one below. In Fig.(A) when you do a simple PowerShell query to get information on a service it only returns a default basic subset of the data on the service. 

PowerShell Use with -properties on service

In Fig.(B) I had to change it up a bit to get PowerShell to show all information available properties on output using the cmdlet get-service.

PowerShell Use with -properties on service

In Fig.(C) I now know the full set of properties of Get-Service and use PowerShell pipe | and the select to get the the startup type value which is set to automatic.

PowerShell Use with -properties on service

 In the example below where –properties comes right inline and before the pipe | you actually get the values for each property as well as the property name. If you try the

-properties * with the Get-Service in Fig.(D) it doesn't work. Compare to Fig (B).

PowerShell Use with -properties on service

When I query PowerShell with Active Directory Module with Get-ADUser a short default list of data is returned. Append the -properties with a wildcard * syntax to gather output not shown in the default list.

As you see there is a difference on where the -properties * is placed!

PowerShell Use with get-aduser -properties on service

Conclusion:

The PowerShell -Property switch is used to expand the output of Powershell commands and provide extended output of all values that can be obtained. Realize when and where to apply the usage of either "-property" or use of "select -property". 

bottom of page