LoginSignup
5
10

More than 3 years have passed since last update.

PowerShellでインストール済みプログラムの一覧を取得する

Posted at

方法1: レジストリから取得

$base = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$wow64 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
$path = @(("HKLM:" + $base), ("HKCU:" + $base))
if(Test-Path $wow64){
    $path += $wow64
}

# Get-ChildItemのままだとPSChildNameで名前しか取り出せないので、一旦PSPathを手に入れる。
# そのPathからGet-ItemPropertyを使用してプロパティを覗くと、そこにはDisplayNameやPublisherなどの情報が入っている
Get-ChildItem -Path $path |
    ForEach-Object {Get-ItemProperty -Path $_.PsPath} |
    #プログラムと機能に表示しないものを除外
    Where-Object {$_.systemcomponent -ne 1} |
    #更新インストールのものを除外
    Where-Object {$_.parentkeyname -eq $null} |
    #空白行を除外
    Where-Object {$_.DisplayName -ne $null} |
    Select-Object DisplayName, Publisher, Version |
    Sort-Object DisplayName 

方法2: WMIから取得(ただし不完全)

この方法だと「このユーザーに対してインストール」したプログラムが取得できないようで、「プログラムと機能」の一覧と差が出ます。
WMIからなんとか取得できないか調べたのですが分からなかったので、ご指摘頂けたらとても嬉しいです。

Get-WmiObject Win32_InstalledWin32Program | 
Select-Object Name, Vendor, Version |
Sort-Object Name
5
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
10