32비트, 64비트로 작성된 프로그램이 설치되어 있기 때문에, 설치된 프로그램 리스트를 갖고 오려면 레지스트리 두 군데서 정보를 갖고 와야 합니다
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
$array = @()
$UninstallKeys=”SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall”,
"Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$computerName = "Computer1"
foreach($UninstallKey in $UninstallKeys){
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey(‘LocalMachine’,$computerName)
$regkey=$reg.OpenSubKey($UninstallKey)
$subkeys=$regkey.GetSubKeyNames()
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 ComputerName, DisplayName, DisplayVersion, Publisher | ft -auto
'파워쉘(Powershell) > 예제' 카테고리의 다른 글
파워쉘 Ping ( Test-Connection ) (1) | 2024.04.05 |
---|