Listing All Properties of a SharePoint Artefact using PowerShell

This is a very useful tip I use daily in my work. A while ago, I tried to figure out a way to list all properties of an object and to expose all of their values without having to call one at a time. Since PowerShell object really are .NET entities in the background, each item exposes its own set of properties and methods. We are all familiar with the Get-Member PowerShell cmdlet that gives the name of all methods and properties of an object. However what we are looking for here is​ a way to get a full list of all properties, with their names and values. Using the PowerShell piping functionality, we can simply get a reference to an object, and then pipe it through a Select statement that will query the object for all of its properties. The piping function will then take care of iterating through all of them, and will display its value on screen. The example shown in Figure 1 below shows the execution of this concept on a web object, representing the root web of my site collection:

Get-SPWeb http://localhost | Select -Property *


Using the Select -Property * statement tells PowerShell to grab the object received by the pipe command, to query it for its properties that have a name of * (wildcard) and to list all of there values. Note that this method doesn’T have to be used with SPWeb object, and can be used with any level of SharePoint artefacts. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *