Introduction

PowerShell is a powerful scripting language that allows you to automate various tasks on your computer. One useful task is retrieving a list of installed programs. This can be helpful when you need to troubleshoot or manage software on your system. In this tutorial, we will explore how to use PowerShell to get the list of installed programs.

Method 1: Using the Get-WmiObject Cmdlet

The Get-WmiObject cmdlet in PowerShell allows you to retrieve information from Windows Management Instrumentation (WMI) classes. To get the list of installed programs, we can use the Win32_Product class. Follow the steps below:

  1. Open PowerShell by searching for it in the Start menu.
  2. Type the following command and press Enter:
Get-WmiObject -Class Win32_Product | Select-Object Name

This command retrieves all the installed programs on your computer and selects only the “Name” property to display. The output will be a list of program names.

Note: The Get-WmiObject cmdlet can be slow when retrieving information from the Win32_Product class, especially on systems with a large number of installed programs. If you experience performance issues, consider using alternative methods.

Method 2: Using the Get-ItemProperty Cmdlet

Another way to get the list of installed programs is by using the Get-ItemProperty cmdlet. This cmdlet allows you to retrieve the properties of an item, such as a registry key. Follow the steps below:

  1. Open PowerShell by searching for it in the Start menu.
  2. Type the following command and press Enter:
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName

This command retrieves the properties of all the uninstall registry keys under the “HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall” path. It then selects only the “DisplayName” property to display. The output will be a list of program names.

Note: The Get-ItemProperty cmdlet retrieves information from the registry, which may not include all installed programs. Some programs may not have an uninstall registry key or may store their information in a different location.

Method 3: Using the Registry Provider

The Registry provider in PowerShell allows you to navigate and retrieve information from the Windows registry. Follow the steps below:

  1. Open PowerShell by searching for it in the Start menu.
  2. Type the following command and press Enter:
Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall | ForEach-Object { Get-ItemProperty $_.PSPath } | Select-Object DisplayName

This command retrieves all the child items under the “HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall” path, which represent the installed programs. It then retrieves the properties of each item and selects only the “DisplayName” property to display. The output will be a list of program names.

Note: The Registry provider allows you to access the registry directly, but it requires knowledge of the registry structure and may not include all installed programs if they are stored in different registry locations.

Frequently Asked Questions

Q: Can I retrieve the list of installed programs on remote computers?

A: Yes, you can use PowerShell’s remoting feature to retrieve the list of installed programs on remote computers. Simply specify the computer name in the command, for example:

Invoke-Command -ComputerName "RemoteComputer" -ScriptBlock { Get-WmiObject -Class Win32_Product | Select-Object Name }

Q: How can I export the list of installed programs to a file?

A: To export the list of installed programs to a file, you can use the “Out-File” cmdlet. Simply pipe the output of the command to “Out-File” and specify the file path, for example:

Get-WmiObject -Class Win32_Product | Select-Object Name | Out-File "C:\Programs.txt"

Q: Are there any alternative methods to retrieve the list of installed programs?

A: Yes, there are third-party tools available that provide a graphical interface to view the list of installed programs. One popular tool is “CCleaner” which can be downloaded from their official website: https://www.ccleaner.com/

Conclusion

Retrieving a list of installed programs in PowerShell is a useful skill for managing and troubleshooting software on your computer. In this tutorial, we explored three different methods to accomplish this task. Whether you prefer using WMI classes, registry keys, or the Registry provider, PowerShell provides the flexibility to retrieve the information you need. Experiment with these methods and adapt them to your specific requirements. Happy scripting!