PowerShell: Checking if a Package is Installed and Installed Time

Abstract: Determine if a Windows application is installed and retrieve its accurate installation date by querying the registry instead of relying on unreliable package manager metadata.

Created: 2026-08-03 by
You can verify if a package is installed and retrieve its installation time in PowerShell by using the Get-Package cmdlet with specific filters or by querying the Windows Registry for MSI-based software. While Get-Package returns an empty collection rather than throwing an error when no matches are found, relying on its InstalledDate property can be unreliable because it often reflects the last modification time of the package file rather than the actual system installation timestamp. For accurate results, especially with traditional Windows applications, checking the registry keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall is the most robust method to determine both presence and true install dates.

Using Get-Package for Modern Package Managers

The Get-Package cmdlet is primarily designed for use with package providers like NuGet, Chocolatey, or Winget. It does not inherently scan the entire system for every possible application but instead queries the registered package sources. When you run this command without any arguments, it lists all packages available in your configured sources, which can be overwhelming. To check for a specific package, you must filter the results by name. A common misconception is that Get-Package throws an error if a package is missing. In reality, it simply returns an empty array. This behavior allows you to check the count of returned objects to determine existence. If the count is greater than zero, the package is present in the provider's database. However, the metadata provided by these providers varies significantly. The InstalledDate field may contain a timestamp from when the package was downloaded or cached, not necessarily when it was deployed to the operating system. Therefore, this method is best suited for verifying the presence of packages managed by modern tools where version consistency is critical, but less reliable for determining historical installation times across the whole OS.

Querying the Registry for MSI Installations

For traditional Windows applications installed via MSI (Microsoft Installer) or older setup executables, the registry provides a more consistent source of truth. Windows stores uninstall information for installed programs in specific registry hives. You can query these keys to find if a program is listed and extract the InstallDate value, which is typically formatted as YYYYMMDD. To begin, you need to target the correct registry path. Most 64-bit applications on 64-bit systems are stored under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. On 32-bit systems or 32-bit applications running on 64-bit Windows, they may appear under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall. By iterating through these keys, you can match the DisplayName property against your target application name. Here is how you can construct a script to check for an application named "ExampleApp":
$appName = "ExampleApp"
$regPaths = @(
    "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
    "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
)

foreach ($path in $regPaths) {
    $keys = Get-ChildItem -Path $path -ErrorAction SilentlyContinue
    foreach ($key in $keys) {
        $displayName = Get-ItemProperty -Path $key.PSPath -Name DisplayName -ErrorAction SilentlyContinue | Select-Object -ExpandProperty DisplayName
        if ($displayName -eq $appName) {
            $installDate = Get-ItemProperty -Path $key.PSPath -Name InstallDate -ErrorAction SilentlyContinue | Select-Object -ExpandProperty InstallDate
            Write-Host "Found: $appName at $installDate"
            break
        }
    }
}
This approach directly reads the values written by the installer during the setup process. Unlike package managers, MSI installers strictly adhere to writing the installation date into the registry. This makes it highly reliable for auditing purposes or compliance checks where knowing exactly when software was added to the system is required.

Handling Winget and Chocolatey Specifics

If your environment relies heavily on winget or choco, you should use their respective CLI tools for the most accurate data. winget list provides a clean output of installed packages along with their versions. While it does not always expose the exact install date in the standard table view, you can parse the output or use the --id flag to get detailed info for a single package. Similarly, Chocolatey maintains a log directory that records installation events. Checking the logs in %ProgramData%\chocolatey\logs can provide timestamps for when each package was installed. This is particularly useful for troubleshooting issues where the registry state might be out of sync with the actual package manager state. For deeper integration, consider looking into related automation techniques. For instance, understanding how to manage automatic variables can help streamline your scripts further. You can read more about Understanding Automatic Variables in PowerShell: $global:? to optimize your variable scope when storing these check results.

Best Practices for Verification Scripts

When writing verification scripts, always handle errors gracefully. Use -ErrorAction SilentlyContinue when accessing registry keys or calling external commands to prevent non-terminating errors from halting your script. Additionally, normalize the application name comparison. Use -like or -match operators if exact string matching fails due to trailing spaces or version suffixes in the display name. It is also important to consider permissions. Reading certain registry keys or querying global package providers may require elevated privileges. Ensure your script runs with appropriate access levels to avoid silent failures where data appears missing because the user context lacks read permissions. For more advanced text processing needs within your scripts, such as parsing complex output formats, you might find it helpful to explore other PowerShell capabilities. See our guide on PowerShell Command to Display Specific Text from a Website to learn how to extract precise data strings from larger blocks of text, a skill that translates well to parsing registry or package outputs.

Frequently Asked Questions

Why does Get-Package return null instead of an error?

Get-Package is designed to return an empty collection when no packages match the criteria, rather than throwing a terminating error. This design allows scripts to continue executing even if a specific package is not found. You should always check the length or count of the returned object to determine if the package exists.

Is InstalledDate from Get-Package accurate?

No, the InstalledDate property from Get-Package is often unreliable for determining the actual system installation time. It frequently reflects the date the package file was downloaded or modified in the cache. For true installation timestamps, especially for Windows applications, querying the registry is a superior method.

How do I find 32-bit apps on a 64-bit system?

On 64-bit Windows, 32-bit applications are redirected to the WOW6432Node registry path. You must check both HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall to ensure you capture all installed software regardless of architecture.

Can I use this method for AppX/UWP applications?

Traditional registry keys under Uninstall do not typically store metadata for AppX or UWP applications. These modern apps are managed differently and are better queried using Get-AppxPackage or Get-AppxProvisionedPackage. For these types, the registry method described will not yield results.

What if the DisplayName contains special characters?

Registry DisplayName values can sometimes include trailing spaces or special formatting. Using the -eq operator requires an exact match, which might fail due to whitespace. Using -like "*AppName*" is safer as it performs a substring match, ignoring minor formatting discrepancies.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More