Admins has to uninstall some application from users machines
remotely and some time they has to do
this task remotely without informing user may be those application is unlicensed
app or unwanted app.
I found the very power shell simple command to remove those
applications.
################################ For Single Apps ###################################
$sAplicationUnInstallation
= Get-WmiObject
Win32_Product -ComputerName
"Host-Name" | where { $_.name -eq "AppName" }
$sAplicationUnInstallation.Uninstall()
#################################################################################
################################ For Multiple Apps #################################
$UnInstallApplication = @(“ORCA”, “ClickShare Launcher”)
foreach($UnInstallApplication1 in $UnInstallApplication){
$app = Get-WmiObject -Class Win32_Product -ComputerName "CRP-GDE-W7SCCM" | Where-Object {
$_.Name -match “$UnInstallApplication1”
}
Write-Host $app
if ($app -ne $Null) {
$app.Uninstall()
}
}
#################################################################################
Imp Note:-
This WMI and power shell query will remove application from remote machine . One drawback I found in this command .The application uninstallation string compulsory follow the guide line .it means if you uninstallation MSI based
Installer so uninstallation string must be “MsiExec.exe /X{41EAEB83-2C73-4187-AE15-28B317B4E44C}” if uninstallation
string will be “MsiExec.exe /I{41EAEB83-2C73-4187-AE15-28B317B4E44C}”
then this command will repair and reinstall the msi It will not
uninstall the application. One more info if any application need mandatory reboot
so machine will reboot after uninstallation in some case you cannot stop the
reboot. Please try on test machines before running on production.
Note:- Please test script in your test environment before running in production directly.
Note:- Please test script in your test environment before running in production directly.
No comments:
Post a Comment