Reputation: 3158
We've used the following command found at this link to try and get a complete listing of installed programs in Windows:
Get-WmiObject -Class Win32_Product
However, this gives an incomplete listing of installed programs when compared with the list of installed programs in the Control panel.
Our original intention is to have a script that can interactively and eventually automatically uninstall bloatware installed on a computer. However, the command above misses a handful that we'd like to have uninstalled as well.
Is there another Class
we can look into in order to get the complete listing? Or is there another command altogether that we can use?
Any insight is appreciated
Upvotes: 9
Views: 33631
Reputation: 1
I had the same issue, ended up using:
Get-WmiObject -Class Win32_InstalledWin32Program
Upvotes: 0
Reputation: 5938
The Get-Package
cmdlet provides more information than the Win32_Product
class. Here are the differences between the two on my Windows 10 system:
PS C:\> Get-WmiObject -Class Win32_Product | Where-Object Name -Match TOSHIBA | Format-Table
IdentifyingNumber Name Vendor Version Caption
----------------- ---- ------ ------- -------
{1E6A96A1-2BAB-43EF-8087-30437593C66C} TOSHIBA System Driver Toshiba Corporation 2.00.0005 TOSHIBA System Driver
{1515F5E3-29EA-4CD1-A981-032D88880F09} TOSHIBA Audio Enhancement Toshiba Corporation 3.0.0.9 TOSHIBA Audio Enhancement
{716C8275-A4A9-48CB-88C0-9829334CA3C5} Toshiba Quality Application TOSHIBA 1.0.9.7 Toshiba Quality Application
{E4C7D9D7-19D4-4623-AF0C-EA313C466411} Toshiba TEMPRO Toshiba Europe GmbH 5.0.0 Toshiba TEMPRO
{72EFCFA8-3923-451D-AF52-7CE9D87BC2A1} TOSHIBA eco Utility Toshiba Corporation 3.0.1.6403 TOSHIBA eco Utility
{B040D5C9-C9AA-430A-A44E-696656012E61} TOSHIBA System Settings Toshiba Corporation 3.0.3.6400 TOSHIBA System Settings
{0B39C39A-3ECE-4582-9C91-842D22819A24} TOSHIBA Display Utility Toshiba Corporation 2.0.1.0 TOSHIBA Display Utility
{EDC626BA-3E59-44C4-96B4-9066E29BF600} TOSHIBA Service Station Toshiba Corporation 3.1.0.2 TOSHIBA Service Station
{26BB68BB-CF93-4A12-BC6D-A3B6F53AC8D9} TOSHIBA Password Utility Toshiba Corporation 8.1.1.0 TOSHIBA Password Utility
{B507386D-1F61-4E55-B05B-F56ACB0086B3} TOSHIBA PC Health Monitor Toshiba Corporation 5.01.02.6400 TOSHIBA PC Health Monitor
This one includes extra entries. You should be able to see that it includes entries from the Programs
provider as well as the msi
provider.
PS C:\> Get-Package *TOSHIBA*
Name Version Source ProviderName
---- ------- ------ ------------
TOSHIBA System Driver 2.0.5 C:\Program Files (x86)\TOSHIB... msi
TOSHIBA Audio Enhancement 3.0.0.9 C:\Program Files\TOSHIBA\TOSH... msi
Toshiba Quality Application 1.0.9.7 C:\Program Files (x86)\Toshib... msi
Toshiba TEMPRO 5.0.0 C:\Program Files (x86)\Toshib... msi
TOSHIBA eco Utility 3.0.1.6403 C:\Program Files\TOSHIBA\Teco\ msi
TOSHIBA System Settings 3.0.3.6400 C:\Program Files\TOSHIBA\Syst... msi
TOSHIBA Display Utility 2.0.1.0 C:\Program Files\Toshiba\TOSH... msi
TOSHIBA Service Station 3.1.0.2 msi
TOSHIBA Password Utility 8.1.1.0 C:\Program Files\Toshiba\Pass... msi
TOSHIBA Password Utility 8.1.1.0 Programs
TOSHIBA PC Health Monitor 5.1.2.6400 C:\Program Files\TOSHIBA\TPHM\ msi
TOSHIBA Manuals 10.20 Programs
TOSHIBA Recovery Media Creator 3.3.00.8003 Programs
Deleting packages from the Programs
provider is actually harder than might sound in the first place. Entries in there will generally have an uninstall command or a quiet uninstall command but it's not guaranteed. For cases where there is a quiet uninstall string then you could do something like this:
function Uninstall-Program($Package) {
$Command = foreach ($i in (0..($Package.Meta.Attributes.Keys.Count - 1))) {
if ($Package.Meta.Attributes.Keys[$i] -eq 'QuietUninstallString') {
$Package.Meta.Attributes.Values[$i]
}
}
Invoke-Expression "& $Command"
}
Then you could uninstall with:
$Package = Get-Package "botframework-emulator"
Uninstall-Program $Package
Upvotes: 13