Use PowerShell to list installed applications on remote Windows devices

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稿源:Jeff Wouters's Blog (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合技术 » Use PowerShell to list installed applications on remote Windows devices

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录