Posted on

Taking on PowerShell one cmdlet at a time

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. Adam will be covering Get-ItemProperty this week.
When should you use Get-ItemProperty
The Get-ItemProperty cmdlet retrieves the properties of specified items. This cmdlet can be used to retrieve the LastAccessTime value of a file object. This cmdlet can also be used to view registry entries as well as their values.
What version of PowerShell do I use?
Get the PowerShell Version for your machine
This command displays the PowerShell version information for your machine.

How do I use Get-ItemProperty
Find out more about a directory:
Get-ItemProperty C:\Windows
This command provides information about the directory C:Windows.

Find out the properties of a particular file:
This command retrieves the properties of the C.azurenet.txt. The Format-List cmdlet is used to display the output as an array.
Get-ItemProperty C:\azure\net.txt | Format-List

Display the registry subkey value name and data:
This command displays the data and value names of all registry entries in the “CurrentVersionā€ registry subkey.
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion

NOTE: This command requires that there be a PowerShell drive called HKLM that is mapped with the “HKEY_LOCAL_MACHINEā€ registry hive.
PowerShell will automatically find a drive with this name and mapping. Alternately, you can specify the path to this registry key by using the alternative path that starts with the provider name followed two colons.
Find the value name and data for a registry entry in a subkey registry
This command retrieves the value name and data for the “ProgramFilesDir”, registry entry in the subkey “CurrentVersion”.
The Path parameter specifies the subkey, and the -Name parameter specifies what the value name is for the entry.
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name “ProgramFilesDir”

Learn the command for last week: Get-Item.
Do you need PowerShell training? ITProTV offers PowerShell online IT training courses.