2

I'm working on an application that lists all of the installed programs on a customer's computer. I've been able to get a list based on registry keys, but it doesn't include things that were installed via the Microsoft Store. It looks like using PowerShell (based on the guidance on this page: https://mhelp.pro/how-to-uninstall-windows-apps/) I can get lists of installed applications, but what I'm getting there seems to include a lot of items that aren't in Add/Remove Programs, and I'm not sure how to reconcile the 2 sources (Add/Remove Programs and the lists of programs via PowerShell). Is there some better way I should be doing this, or is there a flag or criteria that I should be using to determine if a listed application is present in Add/Remove Programs?

Marios
  • 26,333
  • 8
  • 32
  • 52
Taylor Logan
  • 41
  • 1
  • 2

2 Answers2

2

Perhaps something like that did you mean ?

Refer to How to Create a List of Your Installed Programs on Windows


$outputFile = "$env:APPDATA\Installed_Applications.txt"
$OS_Architecture = $env:PROCESSOR_ARCHITECTURE
if($OS_Architecture -eq 'x86') 
{
    #write-host '32-bit'
    $key = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
}
else
{
    #write-host '64-bit'
    $key = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
}

Get-ItemProperty $Key |
        Select-Object DisplayName, DisplayVersion, Publisher, InstallDate |
            Format-Table –AutoSize |
                Out-File $outputFile -Encoding UTF8 -Force
                    Start-Process $outputFile

EDIT : 25/08/2020 @ 18:20

Here is a Self-elevate script to get everything with admin rights :

cls
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
  if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
      #$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
      $CommandLine = $MyInvocation.InvocationName
      Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
      Exit
     }
    }

$outputFile = "$env:APPDATA\Installed_Applications.txt"
$OS_Architecture = $env:PROCESSOR_ARCHITECTURE
if($OS_Architecture -eq 'x86') 
{
    #write-host '32-bit'
    $key = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
}
else
{
    #write-host '64-bit'
    $key = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
}

Get-ItemProperty $Key |
        Select-Object DisplayName, DisplayVersion, Publisher, InstallDate |
            Format-Table –AutoSize | Out-String -Width 300 |
                Out-File $outputFile -Encoding UTF8 -Force 
                    Get-AppxPackage -AllUsers |
                        Out-File -Append $outputFile -Encoding UTF8 -Force 
                            Start $outputFile
Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • Hi! This looks like it gets us part of the way there, but it doesn't seem to include everything. For example, on the machines I'm testing on, it looks like Spotify, Candy Crush, and a few other applications were installed automatically (though, through the Microsoft Store) - they don't seem to appear on the list that is generated here. Any idea what I'd need to do to get all of those included also? Thanks! – Taylor Logan Aug 24 '20 at 18:49
1

In powershell 5 but not powershell 7:

get-package
js2010
  • 23,033
  • 6
  • 64
  • 66