PowerShell Uninstall an application

Use powershell to uninstall an application remotely. Connect to the remote machine and verify if the application exists.

PS C:\Windows\System32> enter-PSSession -ComputerName CR003

Verify the app is installed on this machine

[CR003]: PS C:\Users\61\Documents> Get-WmiObject -class win32_product | select-object -property name | where-object name -like '*jabra*'

name
----
Jabra Direct
Jabra Direct

Load the app into a variable

[CR003]: PS C:\Users\61\Documents> $myApp = get-wmiobject -class win32_product | where-object {$_.Name -eq 'Jabra Direct' }

Uninstall the application

[CR003]: PS C:\Users\61\Documents> $myApp.uninstall()


__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 0
PSComputerName   :

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 0
PSComputerName   :

Verify it is uninstalled on the

[CR003]: PS C:\Users\61\Documents> Get-WmiObject -class win32_product | select-object -property name | where-object name -like '*jabra*'
[CR003]: PS C:\Users\61\Documents>

Leave a Reply

Your email address will not be published. Required fields are marked *