Objects, Properties and Methods Part 3
Now let’s take a look at using the Properties of an object
- Let’s use the get-childitem command. First type get-childitem | gm PIPE OPERATOR (hold your shift key down and press the key right above the enter key
Then Type GM press enter
We want to use the creationtime property to find out the creation date of the **current **version of PowerShell, press return
Let’s type the command then I’ll explain it.
Type (Get-ChildItem $pshome\PowerShell.exe).creationtime
- The most common way to get the values of the properties of an object is to
use the dot method. That means that you first surround the parameter and the path with parenthesis. Then insert a (.) then the property. Which in this case is creationtime. Now press return
And we get Wednesday , April 11, 2018 07:35 PM
- By the way $pshome is the path to the PowerShell home folder
Another way to get the properties of an object is to use the select-object command. The select-object command has a parameter called –property that will get the properties of an object.

Let’s type help Select-object -showwindow and let’s analyze the syntax.
- The parameter that we are going to be using is called -property.
Select-object is the name of the cmdlet.
Notice that the parameter -property and the argument’s value type - called object,
both are surrounded by square brackets. That means that both parameter and argument are optional and not needed.
Notice also that -property is surrounded by a separate set of square brackets so**-property** is positional as well.
We can verify that by scrolling up and looking at the parameter attributes. Which tell us that -property has a position of 0, and it is not required.
That tells us that **-property should be locate…
No comments yet. Add the first comment to start the discussion.