Powershell

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

The “Get-ItemPropertyValue” cmdlet is used to get the values for one or more properties of a specified item. Specifically, it gets the current value of a property using the “-Name” parameter specified by the user in the provided path. Initially, it was launched in PowerShell version 5.

This guide will discuss the usage of the “Get-ItemPropertyValue” cmdlet.

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

To use the “Get-ItemPropertyValue” cmdlet, first, add the stated cmdlet. Then, provide it with a property, such as the path of a file/directory or a registry key. Lastly, use the “-Name” parameter to get the property value.

Let’s have a look at the practical examples to learn the usage of the “Get-ItemPropertyValue” cmdlet.

Example 1: Use the “Get-ItemPropertyValue” Cmdlet to Get the Last Edit Time of a File or Directory
Initially, use the “Get-ItemPropertyValue” cmdlet. Then, place the “-Path” parameter and specify the directory address. Lastly, use the “-Name” parameter and assign it the “LastWriteTime” value to get the last edit time of the directory or a file:

Get-ItemPropertyValue -Path "C:\Docs" -Name LastWriteTime

Example 2: Use the “Get-ItemPropertyValue” Cmdlet to Get the Creation Time of a Directory
To retrieve the creation time of a directory, use the “-Name” parameter and specify the “CreationTime” value:

Get-ItemPropertyValue -Path "C:\Docs" -Name CreationTime

Example 3: Use the “Get-ItemPropertyValue” Cmdlet to Get the Value of the PID Property
To get the value of the PID property of a registry key, first, use the “Get-ItemPropertyValue” cmdlet. Then, specify the registry key. After that, write the parameter “-Name” and specify it to the “PID” property:

Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\PowerShell\1' -Name PID

Example 4: Use the “Get-ItemPropertyValue” Cmdlet to Get the Values of Multiple Properties
To use multiple properties, simply assign the properties to the “-Name” parameter in PowerShell:

Get-ItemPropertyValue -Path "C:\Docs" -Name LastWriteTime, Root

That’s it! You have learned the usage of the “Get-ItemPropertyValue” cmdlet in PowerShell.

Conclusion

In PowerShell, the “Get-ItemPropertyValue” cmdlet is used to get the property value of a specified item by the user located in the provided path. This tutorial explained the usage of the “Get-ItemPropertyValue” cmdlet in PowerShell.

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.