Posts

Showing posts from 2017

Powershell - Uninstall Packages Remotely

Recently I have been contemplating how I could more efficiently uninstall or view packages that a user has installed on their computer and then uninstall those packages remotely without having to take the time of the user to do so through a remote interactive session.  

I have written the below Powershell script which will prompt you for the computers name or IP Address that you are working with.  Then it will display the installed programs (Notice in the script you can filter by a package name like Java).  Then you can call the package or packages you would like to uninstall by its name.  If your user account is recognized as a local administrator on the computer you should not have an issue.  It does allow you to use other credentials if necessary.
#Powershell program to remove packages that are specified by the user function remove-Package($package, $compName, $credName) { If ($credName -eq $env:USERNAME) { $s = Get-WmiObject -Class Win32_Product -ComputerName $compN…