2

Is it possible to get a list of installed software of a remote computer ? I know to do this for a local computer with use of Powershell. Is it possible with Powershell to get installed software of a remote computer and save this list on the remote computer ? This I use for local computers: Get-WmiObject -Class Win32_Product | Select-Object -Property Name

Thanks in advance, Best regards,

Joep
  • 39
  • 1
  • 2
  • 10
  • Yep: [Connecting to WMI on a Remote Computer by Using Windows PowerShell](https://msdn.microsoft.com/en-us/library/windows/desktop/ee309377(v=vs.85).aspx) – Alex K. Jan 15 '16 at 14:46
  • 2
    Possible duplicate of [Check computers for installed program in powershell](http://stackoverflow.com/questions/27406010/check-computers-for-installed-program-in-powershell). There's also http://stackoverflow.com/q/34135657/62576 that contains relevant information. Please do a search here before posting a new question; chances are quite good that the question has been asked (and answered) here before. – Ken White Jan 15 '16 at 15:13
  • Get-WmiObject –computername mycomputer -Class Win32_Product | Select-Object -Property Name . I dont think it's a duplicate...but ok , this did the job for me... – Joep Jan 15 '16 at 15:24

3 Answers3

3

This uses Microsoft.Win32.RegistryKey to check the SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall registry key on remote computers.

https://github.com/gangstanthony/PowerShell/blob/master/Get-InstalledApps.ps1

*edit: pasting code for reference

function Get-InstalledApps {
    param (
        [Parameter(ValueFromPipeline=$true)]
        [string[]]$ComputerName = $env:COMPUTERNAME,
        [string]$NameRegex = ''
    )
    
    foreach ($comp in $ComputerName) {
        $keys = '','\Wow6432Node'
        foreach ($key in $keys) {
            try {
                $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $comp)
                $apps = $reg.OpenSubKey("SOFTWARE$key\Microsoft\Windows\CurrentVersion\Uninstall").GetSubKeyNames()
            } catch {
                continue
            }

            foreach ($app in $apps) {
                $program = $reg.OpenSubKey("SOFTWARE$key\Microsoft\Windows\CurrentVersion\Uninstall\$app")
                $name = $program.GetValue('DisplayName')
                if ($name -and $name -match $NameRegex) {
                    [pscustomobject]@{
                        ComputerName = $comp
                        DisplayName = $name
                        DisplayVersion = $program.GetValue('DisplayVersion')
                        Publisher = $program.GetValue('Publisher')
                        InstallDate = $program.GetValue('InstallDate')
                        UninstallString = $program.GetValue('UninstallString')
                        Bits = $(if ($key -eq '\Wow6432Node') {'64'} else {'32'})
                        Path = $program.name
                    }
                }
            }
        }
    }
}
Anthony Stringer
  • 1,981
  • 1
  • 10
  • 15
1

There are multiple ways how to get the list of installed software on a remote computer:

  1. Running WMI query on ROOT\CIMV2 namespace:

    • Start WMI Explorer or any other tool which can run WMI queries.
    • Run WMI query "SELECT * FROM Win32_Product"
  2. Using wmic command-line interface:

    • Press WIN+R
    • Type "wmic", press Enter
    • In wmic command prompt type "/node:RemoteComputerName product"
  3. Using Powershell script:

    • Thru WMI object: Get-WmiObject -Class Win32_Product -Computer RemoteComputerName
    • thru Registry: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize
    • thru Get-RemoteProgram cmdlet: Get-RemoteProgram -ComputerName RemoteComputerName

Source: https://www.action1.com/kb/list_of_installed_software_on_remote_computer.html

0

No one seems to know about get-package in powershell 5.1. You'll have to use invoke-command to run it on a remote computer.

get-package | more

Name                           Version          Source                 ProviderName
----                           -------          ------                 ------------
7-Zip 21.07 (x64)              21.07                                   Msi
Wolfram Extras 11.0 (5570611)  11.0.0                                  Programs
ArcGIS Desktop Background G... 10.8.12790                              Programs
# and so on...

msi provider uninstall:

get-package *chrome* | uninstall-package

programs provider uninstall varies:

get-package *notepad++* | % { & $_.metadata['uninstallstring'] /S }
js2010
  • 23,033
  • 6
  • 64
  • 66
  • There are a multitude of different ways for software to be installed on Windows. Not everything that's installed is visible through WMI, not everything is visible through the PackageManagement module (i.e. Get-Package). It's a mess, so you have to use whichever module(s) works with the software you intend to remove. Here's another reference discussing this (ignore the statement _"(WMI) is the only mechanism mentioned here that can perform this task remotely."_) [link](https://4sysops.com/archives/uninstall-programs-remotely-with-powershell/) – timbck2 Aug 10 '23 at 17:48