Home > Back-end >  How to get the full list of applications like in control panel
How to get the full list of applications like in control panel

Time:09-27

I have been stuck at this stage of my little project. What I try to do is list the applications that are installed and choose one of the apps to uninstall, the issue I have is that not all the apps appear, so I can't select them. For example Google chrome is not appearing while I'm using it right now to write this question.

I use this function to get all the apps:

Get-WmiObject Win32_Product -ComputerName $ComputerName | Select-Object -Property Name | Out-GridView -Title "All apps on destination Computer"

and this is whole script:

    $ComputerName = Read-Host -Prompt 'Input the computer name' # the name of the computer to remove the app from

Get-WmiObject Win32_Product -ComputerName $ComputerName | Select-Object -Property Name | Out-GridView -Title "All apps on destination Computer"

$Name = Read-Host -Prompt 'Input name of the application (has to be exact name)'  #name of the application
$Application = Get-WmiObject Win32_Product -ComputerName $ComputerName | Where-Object {$_.Name -eq $Name}  #choose the object, this will be the app that we will delete
if ($Application) {
  $Application.Uninstall()
  "The removal was successful"
}
else {
  $Name   ' is not installed on '   $ComputerName
}
Start-Sleep -Seconds 10

I'm not that good with PowerShell so excuse me if this is a stupid question

CodePudding user response:

Or get-package, which should be faster. Uninstall-package only works on msi providers. Powershell 5.1 only. Metadata['uninstallstring'] has the uninstall string for Programs providers. It can take wildcards and arrays as arguments. Install-package works with msi files, but without any extra options.

get-package
  • Related