Posted on

Get-ItemPropertyValue | Taking on PowerShell one cmdlet at a time | Weekly Blog

Share this post:This blog post is part of an ongoing series by Adam Gordon. Adam will show you how to use each PowerShell command each week. This week, Adam covers Get-ItemPropertyValue.

When to use Get-ItemPropertyValue?
The Get-ItemPropertyValue gets the current value for a property that you specify when you use the -Name parameter, located in a path that you specify with either the -Path or -LiteralPath parameters.
What version of PowerShell do I use?
Get the PowerShell Version for your machine
$PSVersionTable
This command displays the PowerShell version information for your machine.

How to use Get-ItemPropertyValue?
Find out the ProductID property’s value:
Get-ItemPropertyValue ‘HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion’ -Name ProductID
This command gets the value of the ProductID property of the “\SOFTWARE\Microsoft\Windows NT\CurrentVersion” object in the Windows Registry provider.

Find the last written time of a folder or file:
This command gets the value of the LastWriteTime property, or the last time a file or folder was changed, from the “C:\Users\Test\Documents\ModuleToAssembly” folder, working in the FileSystem provider.
Get-ItemPropertyValue -Path C:\PShellTest -Name LastWriteTime

Multiple property values can be assigned to a folder or file:
This command returns the LastWriteTime and CreationTime values for a folder. The property values are returned in order you specified the property names.
Get-ItemPropertyValue -Path C:\PShellTest\ITPTV1 -Name LastWriteTime,CreationTime,Root

Get-ItemProperty is the command last week.
Do you need PowerShell training? ITProTV offers PowerShell online IT training courses.