PowerShell Get-ItemProperty [with Examples]

As a PowerShell administrator, I use the Get-ItemProperty cmdlet a lot. You can use this cmdlet to gather installed software information, access registry values, or retrieve file metadata, etc.

In this tutorial, I will explain how to use Get-ItemProperty in PowerShell effectively with real-world examples that I’ve personally used throughout my decade-plus career with PowerShell.

What is Get-ItemProperty in PowerShell?

Get-ItemProperty is a PowerShell cmdlet that retrieves the properties of specified items. While it’s most commonly used for reading registry entries, it’s equally effective for retrieving file and folder properties.

Think of it as your window into the detailed information about nearly any object in Windows. The beauty of this cmdlet is its consistency – the same syntax works across various data sources.

Chekc out PowerShell Test-Path

Retrieve Registry Values with Get-ItemProperty

Now, let me explain how to retrieve registry values using the Get-ItemProperty in PowerShell.

Method 1 – Basic Registry Access

The registry is where Windows stores critical configuration data, and Get-ItemProperty makes accessing it straightforward.

Here’s how to read values from a specific registry key:

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

When I run this command, I get detailed information about my Windows version, including ProductName, EditionID, and BuildNumber.

You can see the exact output in the screenshot below:

PowerShell Get-ItemProperty

To view a specific property, I can use:

(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ProductName

This returns just the ProductName value, which is helpful when I need only a specific piece of information.

Check out PowerShell Execution Policy

Method 2 – Find Installed Software

One of my favorite uses for Get-ItemProperty is gathering information about installed applications. Here’s how I do it:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | 
Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | 
Where-Object DisplayName -ne $null | 
Sort-Object DisplayName

This command checks the 32-bit application registry path. For 64-bit applications, I use:

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | 
Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | 
Where-Object DisplayName -ne $null | 
Sort-Object DisplayName

I often combine these results to get a complete list of all installed applications.

Check out PowerShell Where-Object

Get File Properties using PowerShell Get-ItemProperty

Now, let me show you how to get file properties using the Get-ItemProperty cmdlet in PowerShell.

Method 1 – Basic File Properties

Beyond registry values, Get-ItemProperty is excellent for retrieving file metadata:

Get-ItemProperty -Path "C:\Reports\QuarterlySales.xlsx"

This returns file attributes like LastWriteTime, CreationTime, and Length.

I executed the above PowerShell script using VS Code, and you can see the exact output in the screenshot below:

Get-ItemProperty in PowerShell

Check out Delete Files Older Than X Days With Specific Extensions Using PowerShell

Method 2 – Getting Specific File Attributes

When I need specific file attributes, I often combine Get-ItemProperty with Select-Object:

Get-ItemProperty -Path "C:\Users\Administrator\Documents\*.docx" | 
Select-Object Name, LastWriteTime, Length

This gives me a neat list of Word documents with their names, last modified dates, and file sizes.

Check out How to Count Files in a Folder Using PowerShell

PowerShell Get-ItemProperty Examples

Now, let me show you a few examples of using the PowerShell Get-ItemProperty cmdlet.

Example 1 – Read Extended File Properties

Windows files have extended properties that aren’t visible with basic commands. Here’s how I access them:

$shell = New-Object -ComObject Shell.Application
$folder = $shell.Namespace("C:\Photos")
$file = $folder.ParseName("Vacation2023.jpg")

# Get the Author property (property index 20)
$folder.GetDetailsOf($file, 20)

This technique lets me access properties like image dimensions, camera information, and metadata that’s not available through standard methods.

Example 2 – Work with Remote Registry

Get-ItemProperty works seamlessly with remote systems too:

Invoke-Command -ComputerName "SERVER01" -ScriptBlock {
    Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
}

I use this approach when I need to gather information from multiple servers without having to log into each one.

Check out Get the Last Modified Date of a File in PowerShell

Example 3: Find Windows Activation Status

Here’s a script I’ve used to check Windows activation status across multiple machines:

$computers = "WORKSTATION01", "WORKSTATION02", "WORKSTATION03"

foreach ($computer in $computers) {
    try {
        $status = Invoke-Command -ComputerName $computer -ScriptBlock {
            (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform").LicenseStatus
        } -ErrorAction Stop

        $activationStatus = switch ($status) {
            0 {"Unlicensed"}
            1 {"Licensed"}
            2 {"Out-of-Box Grace Period"}
            3 {"Out-of-Tolerance Grace Period"}
            4 {"Non-Genuine Grace Period"}
            5 {"Notification"}
            6 {"Extended Grace"}
            default {"Unknown"}
        }

        [PSCustomObject]@{
            Computer = $computer
            ActivationStatus = $activationStatus
        }
    }
    catch {
        [PSCustomObject]@{
            Computer = $computer
            ActivationStatus = "Error: $_"
        }
    }
}

Example 4: Track USB Device History

This script uses Get-ItemProperty to list previously connected USB devices in PowerShell:

Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR\*\*" | 
Select-Object FriendlyName, @{Name='LastConnected';Expression={
    $deviceParams = Get-ItemProperty -Path "$($_.PSPath)\Device Parameters" -ErrorAction SilentlyContinue
    if ($deviceParams -and $deviceParams.LastArrivalDate) {
        $deviceParams.LastArrivalDate
    } else {
        "Unknown"
    }
}} | Sort-Object LastConnected -Descending

This has been incredibly useful for security auditing and tracking removable storage devices.

Read Write to File Line by Line in PowerShell

Common Issues and Troubleshooting

Now, let me show you some common issues and troubleshooting steps.

Issue 1: Access Denied Errors

If you encounter “Access Denied” errors, it’s typically a permissions issue. I resolve this by:

  1. Ensuring I’m running PowerShell as Administrator
  2. Using the correct PSDrive syntax (HKLM:\ instead of HKEY_LOCAL_MACHINE)
  3. Adjusting registry permissions if necessary

Issue 2: Path Not Found

When “Path Not Found” errors occur, I check for:

  1. Typos in the registry path
  2. Registry keys that might be different on various Windows versions
  3. 32-bit vs. 64-bit registry redirections

Registry Paths Reference Table

Here’s a table of commonly used registry paths with Get-ItemProperty:

DescriptionRegistry Path
Windows Version InfoHKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion
Installed Software (64-bit)HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall*
Installed Software (32-bit)HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall*
Current User SettingsHKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Startup ProgramsHKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Network InterfacesHKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces*
USB Devices HistoryHKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR**

I hope these examples help you learn Get-ItemProperty in your own PowerShell scripts. If you have questions or want to share how you’re using this cmdlet, please let me know in the comments below.

Other PowerShell articles you may also like:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App