Use PowerShell to list installed applications on remote Windows devices

综合技术 2015-01-07

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 = 'SOFTWAREMicrosoftWindowsCurrentVersionUninstall',
							'SOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall'
	} 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
							}
						}
					}
				}
			}
		}
	}
}
Jeff Wouters's Blog

责编内容by:Jeff Wouters's Blog (源链)。感谢您的支持!

您可能感兴趣的

SPN Discovery Services that support Kerberos authentication require to have a Service Princ...
Find and recover deleted files and previous versio... PreviousFilesRecovery is a new tool for Windows 10/8/7/Vista that allows you to...
绿盟科技互联网安全威胁周报 ——第 201825周... 阅读: 12 绿盟科技发布了本周安全通告,周报编号NSFOCUS-18-25, 绿盟科技漏洞库 本周新增漏洞记录52条,其中高危漏洞2...
微软发布PowerShell快照预览 支持Ubuntu等GNU/Linux发行版... 近年来,微软为开源社区做出了很多的贡献,并且与 Canonical 达成了友好的合作。 而今天,我们看到了微软面向 Ubuntu as a Snap 发布的 ...
How Windows Has Become More User-Friendly, 5 Examp... Windows gets a lot of undeserved hate. Critics love to describe Windows as a...