Powershell

How to Use the Get-ItemProperty (Microsoft.PowerShell.Management) Cmdlet in PowerShell?

The “Get-ItemProperty” cmdlet is used to get the property of a specified item in a namespace provider. A namespace is similar to the data store that can be accessible in PowerShell. Additionally, it can be utilized to retrieve information regarding the name, size, and type attributes of a specified item. It can help the user observe registry entries and their values.

This post will illustrate PowerShell’s cmdlet “Get-ItemProperty” in detail.

How to Use the Get-ItemProperty (Microsoft.PowerShell.Management) Cmdlet in PowerShell?

To retrieve an item’s property value, first, place the “Get-ItemProperty” cmdlet. Then, specify the item to get its property value. Let’s check out the specified examples to learn more about the stated cmdlet.

Example 1: Utilize the Cmdlet “Get-ItemProperty” to Retrieve Information Related to a Mentioned Folder/Directory
Run the below-given code with the specified directory to retrieve the information of a specified directory:

Get-ItemProperty C:\Docs

Example 2: Use the Cmdlet “Get-ItemProperty” to Retrieve the File’s Properties
Specify the “Get-ItemProperty” having the particular file address assigned to it. Then, pipe it to the cmdlet “Format-List” to get the properties of a specific file:

Get-ItemProperty C:\Docs\New_File.txt | Format-List

Example 3: Use the Cmdlet “Get-ItemProperty” to Retrieve the Registry Entry in a Registry Subkey’s Value Name and Data
Execute the provided command to retrieve the name and data values of a registry key:

Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name "DevicePath"

That’s all! You have learned about the “Get-ItemProperty” cmdlet in-depth.

Conclusion

The “Get-ItemProperty” cmdlet in PowerShell is used to retrieve the property of a specified item. These items could include files or a registry. In this post, the “Get-ItemProperty” cmdlet has been explained in detail with the aid of examples.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.