Get a list of installed powershell programs. Remote removal of programs using WMI

💖 Like it? Share the link with your friends

In the work of an administrator, it often becomes necessary to check whether a certain program is installed on a certain computer on the network and what version. For example, you can check if an important update is installed or if all workstations have the correct version of Office.
How to do this using or scripts (for example), is described below.

The idea is based on the fact that information about installed programs ah is located in the system registry at:
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\

The specified registry branch only lists programs installed "for all users", while programs "for this user" are listed in the branch:
HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall

On Windows x64, the list of programs is also stored in the registry folder:
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

Accordingly, to obtain a complete list, you will need to scan information from all three branches of the registry.

For example, in VBScript:

Const HKLM = &H80000002 "HKEY_LOCAL_MACHINE" strComputer = "computer" strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" strEntry1a = "DisplayName" strEntry1b = "QuietDisplayName" strEntry2 = "InstallDate" strEntry3 = "VersionMajor" strEntry4 = "VersionMinor" strEntry5 = "EstimatedSize" Set objReg = GetObject("winmgmts://" & strComputer & _ "/root/default:StdRegProv") objReg.EnumKey HKLM, strKey, arrSubkeys WScript.Echo "Installed Applications (" & strComputer & ") " & VbCrLf For Each strSubkey In arrSubkeys intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _ strEntry1a, strValue1) If intRet1<>0 Then objReg.GetStringValue HKLM, strKey & strSubkey, _ strEntry1b, strValue1 End If If strValue1<>"" Then WScript.Echo VbCrLf & "Display Name: " & strValue1 End If objReg.GetStringValue HKLM, strKey & strSubkey, _ strEntry2, strValue2 If strValue2<>"" Then WScript.Echo "Install Date: " & strValue2 End If objReg.GetDWORDValue HKLM, strKey & strSubkey, _ strEntry3, intValue3 objReg.GetDWORDValue HKLM, strKey & strSubkey, _ strEntry4, intValue4 If intValue3<>"" Then WScript.Echo "Version: "& intValue3 & "." & intValue4 End If objReg.GetDWORDValue HKLM, strKey & strSubkey, _ strEntry5, intValue5 If intValue5<>"" Then WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes" End If Next

The script connects to a computer with the network name strComputer, looks through the registry key SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ and displays information about programs.

Similar actions can be performed in a CMD batch file. This batch file gives a list of programs:

@echo off rem This batch file writes a list of programs installed on rem on the remote computer. rem %1 Network computer name in PCNAME format (empty value means rem local computer). rem Determine the path to the registry folder set reg_key=hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall if not "%1" == "" set reg_key=\\%~1\%reg_key% rem Loop through installed programs for /F " tokens=1,2,*" %%a in ("reg query "%reg_key%" /s") do ^ if "%%a" == "DisplayName" echo %%c

To check if a particular program (by name) is installed on any one computer, you can use the following batch file check-app-pc.cmd

@echo off rem This batch file checks if given program on rem remote computer. rem %1 Full name of the program or part of the name, for example, KB2570791. rem %2 The network name of the computer in PCNAME format (empty means rem is the local computer). rem Return codes: rem 0 The program is installed. rem 2 Program not found. rem 87 Error in parameters. set app_name=%1 set pc_name=%2 rem Check if call apps.cmd %2 | findstr /i "%~1" if errorlevel 1 echo "%~1" program not found&& exit /b 2 echo "%~1" program installed. && exit /b 0

Accordingly, the check-app-pc.cmd KB2570791 ws_alex command will check if the KB2570791 update is installed on the WS_ALEX computer.
Now you can automate the work of this batch file by adding a check for more computers on the list. To do this, we create a batch file check-app-pclist.cmd with a loop that goes through the lines of a text file with network names of computers.

@echo off rem %1 The full program name or part of the program name. rem %2 Name of the file with the list of computers. rem Note: this batch file uses check-app-pclist.cmd if "%~1" == "" exit /b 87 if not exist %2 exit /b 2 for /F %%a in (%2) do ( echo %%a... call check-app-pc.cmd %1 %%a)

pc.list file list example

SERVER_DB SERVER_FILES WS_ALEX WS_RECEPTION

You can now use the check-app-pclist.cmd KB2570791 pc.list command to check if the KB2570791 update is installed on each computer listed in the pc.list file.

List of installed programs over the network

In this guide, we will show you several ways to get a list of installed programs in Windows 10, Windows 8 or Windows 7 using the command line. This technique for building a list of programs on a system can be useful before reinstalling a system, when looking for unwanted software, or when performing an inventory of installed software on an organization's computers.

Let's consider two methods: the first involves using the command line and the wmic utility, the second is PowerShell.

Listing Programs Using the WMIC Command Line Utility

The list of programs installed on the system can be obtained using the WMIC command line utility, through which you can access and query the WMI namespace. Launch a command prompt with administrator rights and run the command:

wmic product get name,version

After a short wait, a list of names and versions of programs installed in the system will be displayed on the console screen.

This list can be exported to text file using the command:

wmic product get name,version /format:csv > c:\Temp\Programs_%Computername%.csv

After the command is finished, go to the C:\Temp directory and find csv file, whose name starts with Programs_[PC_name]. AT given file in csv format, in addition to the name and version of the software, it will also contain the name of the PC (convenient for further analysis).

Listing Programs Using Windows PowerShell

The list of installed programs can also be obtained using PowerShell. The idea of ​​the method is that the list of installed programs that we see in the list Programs and Features Control Panel, built on the basis of data stored in the registry branch HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Our task is to display the contents of this registry branch. So, start the Powershell console and run the command:

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, Size, InstallDate | Format-Table -AutoSize

As you can see, the resulting list contains the program name, version, developer, and installation date.

Advice. For 32-bit applications on x64 Windows versions, you also need to take data from the branch HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

You can export the resulting list to a csv file like this:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize > c:\temp\ installed-software.txt

The above method allows you to display data only about the classic Windows applications. To display a list of installed Metro applications, use the command:

Get-AppxPackage | Select Name, PackageFullName |Format-Table -AutoSize > c:\temp\installed_metro_apps.txt

To get a list of installed software on remote computer(for example, with the name wks_name11), we will use the Invoke-command cmdlet:

Invoke-command -computer wks_name11 (Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize )

To compare installed software lists from two different computers and find missing applications, you can use the following command:

Compare-Object –ReferenceObject (Get-Content C:\temp\installed-software.txt) –DifferenceObject (Get-Content C:\temp\installed-software2.txt)

In our example, the two compared lists have differences in the two programs.

Another way to list installed programs is to use the Get-WmiObject cmdlet, which also allows you to access the WMI space:

Get-WmiObject -Class Win32_Product | Select-Object -Property Name

How to get a list of installed programs in the Windows operating system? You can get a list of programs installed on your computer in several ways.

In this article, we'll cover three different ways: using the command line, Windows PowerShell, and CCleaner. The list of installed programs will be saved on your computer in a text file.

You can view the list of installed programs directly in the Windows operating system. You can also view this list of installed programs using optimizer programs or uninstallers (you will see all installed applications in the program window).

A complete list of installed programs may be needed for the following purposes: to install desired programs, after installing (reinstalling) the Windows operating system, after buying a new computer in order not to forget to install all the necessary applications, to detect unwanted software, which entered the computer without the knowledge of the user.

How to view a list of installed programs using the command line

Enter the Start menu, launch a command prompt as an administrator, and then type the following command:

Depending on what you want: look in the command line interpreter window for a list installed applications, or save the list of installed programs on the computer as a text file, run the appropriate commands.

To view a list of programs, enter the following command:

Product get name,version

After entering the appropriate command, do not forget to press the "Enter" key. Wait a bit, because the list of installed applications will not be generated immediately. You will see a list of installed programs in the form of a table.

To save a list of programs on the computer, enter the command:

/output:C:\appsfile.txt product get name,version

The table displays the program name and application version number.

Please note that this command has chosen to save the text file "appsfile" on the "C" drive. You can choose another drive on your computer to save the file in ".txt" format.

How to get a list of installed programs using Windows PowerShell

On Windows 10, or Windows 8, type "powershell" (without quotes) in the search box. Next, right-click on Windows PowerShell, and then click on Run as administrator.

In the Windows PowerShell window, enter the command to display a list of installed programs:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

Then press the "Enter" key.

If you want to immediately get a list of installed programs in a text file, enter this command:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize > C:\apps-list.txt

Press the "Enter" key on your keyboard.

This command chooses to save the "apps-list" file in the ".txt" format on the "C" drive.

In the table you will see: the name of the application and the version of the program.

To save a list of applications obtained from the Windows Store, run the following command in PowerShell:

Get-AppxPackage | Select Name, PackageFullName | Format-Table -AutoSize > C:\store-apps-list.txt

How to keep a list of installed programs in CCleaner

In the window that opens, select a location to save the text file. By default, the saved file is named "install".

The file contains the following information about programs: program name, publisher, installation date, size, version.

Article Conclusions

If necessary, the user can get a list of programs installed on the computer running the operating system. Windows system. The list of installed programs can be saved on the computer as a text file using the command line, Windows PowerShell, CCleaner.

I think that all of our readers have experienced the need reinstalling Windows. Sometimes this happens due to critical errors and problems that have arisen, sometimes it is caused by an upgrade, sometimes it is dictated by the desire to dump all the rubbish accumulated in the system and start a computer life from scratch. Immediately after installation new system you install the necessary drivers and system components, and then proceed to restore the familiar software environment. For this task, a pre-compiled list of applications will be very useful to you, especially if it has several dozen items. Now we will learn how to compose it (without a pen and paper! :).

Method 1. Use the command line

Open the Start menu and type "cmd" into the search bar. Right-click on the found element and select from context menu Run as Administrator. In Windows 8, it's about the same, only instead of Start, press the Win button on your keyboard.

Enter two commands in sequence:

WMIC product get name,version

After a short wait, you will see a list of all programs installed on your system in the window.

/output:D:\installedapps.txt product get name,version

Now you just have to open file manager drive D (you can, of course, specify another save path) and you will see a text file there installedapps.txt with a list of all installed programs .


Method 2. CCleaner

For those users who, as a child, were frightened by the black-and-black command line, there is an easier way, but it requires an additional program. It will be played by the popular CCleaner utility, which is installed on almost any computer. In addition, this method allows you to generate more full list your software.

Open CCleaner and go to Service. Here you will see a complete list of programs and you only need to click the button Save report in the bottom right corner to save it to a text file.

After that, you need to choose a path to save and a file name. The list created in this way carries more information than the one generated using the command line, since it contains information about the publisher, size, and date of installation.

Those who want to torture themselves a little can use the usual command line. Launching the console cmd as an administrator, run these two commands in sequence:

WMIC
/output:D:\myapps.txt product get name, version

The list of programs will be saved to a text file myapps.txt with the name and version of the product. This method, however, is somewhat "limping", - some installed applications may not be included in the list. You can also get a list of installed programs using the console. The following command is used for this:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > D:\apps.txt

Get - ItemProperty HKLM :\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select - Object DisplayName , DisplayVersion , Publisher , InstallDate | Format-Table –AutoSize & gt ; D:\apps. txt

The list of applications will be output to a file apps.txt, which is in the root of the disk D . But this method also has its drawbacks, since installed programs can store their data in different registry keys.

In fact, there is a much simpler and convenient way get a list of installed applications. Surely every user has a popular disk cleaner on their computer. Open it, switch to the section "Service" and being on the tab "Remove Programs", press the button "Save Report" and specify the path to save the text file.

In this case, the list will include not only desktop, but also universal applications that were originally present in Windows and those that were installed from the Store.

For each application, its name, version, developer and date of installation will be indicated.

tell friends