Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Created July 11, 2017 09:57
Show Gist options
  • Save g3rhard/50a423cca0f3913ecf301a08d705f656 to your computer and use it in GitHub Desktop.
Save g3rhard/50a423cca0f3913ecf301a08d705f656 to your computer and use it in GitHub Desktop.
Узнаем список установленного ПО через Powershell
# https://blogs.technet.microsoft.com/heyscriptingguy/2011/11/13/use-powershell-to-quickly-find-installed-software/
$computername=(get-childitem -path env:computername).value
$UninstallKey="SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
#$UninstallKey="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$computername)
$regkey=$reg.OpenSubKey($UninstallKey)
$subkeys=$regkey.GetSubKeyNames()
$array = @()
foreach($key in $subkeys){
$thisKey=$UninstallKey+"\\"+$key
$thisSubKey=$reg.OpenSubKey($thisKey)
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $computername
$obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.GetValue("DisplayName"))
$obj | Add-Member -MemberType NoteProperty -Name "DisplayVersion" -Value $($thisSubKey.GetValue("DisplayVersion"))
$obj | Add-Member -MemberType NoteProperty -Name "InstallLocation" -Value $($thisSubKey.GetValue("InstallLocation"))
$obj | Add-Member -MemberType NoteProperty -Name "Publisher" -Value $($thisSubKey.GetValue("Publisher"))
$array += $obj
}
$array | Where-Object { $_.DisplayName } | select DisplayName, DisplayVersion | ft -auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment