Uninstall Package with PowerShell (One Line!)
I recently was in a situation where I needed to uninstall the Netskope client via Intune with PowerShell. These couple commands helped me knock this out quickly.
Get-Package -Provider Programs -IncludeWindowsInstaller -Name “Netskope Client”
To get PowerShell to display all the programs on the Control Panel, use an asterisk in place of the Name parameter. Note that if you’ve installed multiple versions, this command uninstalls only the latest version.
In the above example, it will be:
Uninstall-Package -Name "Netskope Client"
/You can also choose to uninstall a specific version or pipe the output of Get-Package to Uninstall-Package. Here’s an example.
Get-Package -Name "Netskope Client" | Uninstall-Package
Once I had this one-liner, I was able to save it as a .ps1 file, upload to Intune, and I was off to the races.