Get A List Of Software Installed On Windows And Uninstall Software Using Powershell

The Get-AppxPackage cmdlet can be used to obtain a list of all apps installed on a Windows host. In the following example, we’ll look at the apps installed for all users using the -AllUsers option.

Get-AppxPackage -AllUsers

The output includes a Name, the name of the publisher, along with a location, the architecture, the version, the full name, the status, whether the software is signed, whether the development mode is enabled (useful when testing), the id of the publisher, the family, etc.

Next we’ll do a Select against the found set. You can use so stdout displays the Name and the unique identifier, which we can then use to programmatically work with the package if needed (you can choose any of the metadata from the previous command in the select):

Get-AppxPackage -AllUsers | Select Name, PackageFullName

If you want, you can use -User instead of -AllUsers, to see the output of just a given package. One challenge with using Get-Appxpackage is that you don’t get the actual “Product Name” so if you, for example, wanted to uninstall a program, you’d need to hop into WMI. First, let’s use gwmi to find a product with the word Krypted in the name:

$Key = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -match "Krypted"
}

Next, let’s use the $Key from the output to uninstall the software:

$Key.Uninstall()

Show Logical Disks in Windows with PowerShell

Quick & dirty, needed to loop through some servers to look at the logical volumes available on each. Using get-WmiObject you can query the available disks for Windows servers:
get-WmiObject win32_logicaldisk
There were a lot of servers, so then I realized I only cared about disks that were named a certain way. As with posix, you can pipe data, so I used where to constrain the output to those with names matching a certain disk name I was looking for:
get-WmiObject win32_logicaldisk | where {$_.name -match “SomeName”}
Isn’t server sprawl so much fun…