Quantcast
Channel: Microsoft – JeffOps
Viewing all articles
Browse latest Browse all 120

Use PowerShell to list installed applications on remote Windows devices

$
0
0

This has been done a lot of times, by multiple people.
I thought it was about time to share my function with you which allows you to list installed applications / programs on remote (Windows) devices.

function Get-RemoteApplication {
    [CmdletBinding(SupportsShouldProcess=$true)]
    param(
        [Parameter(
            ValueFromPipeline=$true,
            ValueFromPipelineByPropertyName=$true,
            Position=1
        )]
        [string[]]$ComputerName = $env:COMPUTERNAME
    )
    begin {
        $RegistryPath = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\',
                            'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'
    } process {
        foreach ($Computer in $ComputerName) {
            $Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Computer)
            foreach ($RegPath in $RegistryPath) {
                ($Registry.OpenSubKey($RegPath)) | foreach {
                    $_.GetSubKeyNames() | ForEach-Object {
                        $ApplicationName = ($Registry.OpenSubKey("$RegPath$_")).GetValue('DisplayName')
                        if ([bool]$ApplicationName) {
                            New-Object -TypeName PSCustomObject -Property @{
                                'ComputerName' = $Computer
                                'Application' = $ApplicationName
                            }
                        }
                    }
                }
            }
        }
    }
}

Viewing all articles
Browse latest Browse all 120

Trending Articles