Uninstall all versions of flash player and flash plugins
Hi folks,
I need to uninstall all version of flash player
and browser plugins on all my machines.
From Kace I can see that I have all versions from
version-10 to version-21 and everything in between.
version 21 uninstalls fine with this script....
"wmic product where "name like 'Adobe Flash Player%%'" call uninstall /nointeractive".
But some of the older ones are not going.
Any script, to uninstall all versions at once?
Really appreciate it.
Answers (4)
Comments:
-
Tried locally.......
@echo off
CLS
echo removing old flash player
call "C:\Users\admin\Desktop\uninstall_flash_player.exe" -uninstall
Exit
working perfectly!!!!!
BUT..for this I would have to download it to every machine on the
network and run the script as the logged on user.
Problem is ... all my users don't have install or uninstall rights.
So the best way would be to use it as a dependency in the kace via scripting.......
That way the executable runs on every machine as "local system" with full
rights to un install anything. So tried..........
@echo off
CLS
echo removing old flash player
call "$(KACE_DEPENDENCY_DIR)\uninstall_flash_player.exe" -uninstall
Exit
Not working!!!!!
Any ideas?
Thanks - akmagnum 8 years ago -
Got it to work liam.
Thanks a lot my friend. - akmagnum 8 years ago-
No worries buddy, Did you place the file on the network and then point the Batch file to that location ? that way you wouldn't have to download it on every computer. - liam.creaser 8 years ago
-
...the ionly downside being that the System account has no network access, of course, so unless you're using a special installation user or your users have local admin rights... - anonymous_9363 8 years ago
########################################
#Flash Player Preinstall Cleanup Script#
# Creation Date: 01/15/2017 #
# Version: 24 #
# Author: Stephen Wheeler #
########################################
$CurVer = "FlashPlayer_24.0.194"
Start-transcript -path C:\Log\SCRIPTS\FlashPlayer_DetailedLog.txt -noClobber -Append
#This is calling the "Flashutil" application to attempt to uninstall the currently installed version of Flash Player.
Write-Host "First Off we are going to politely ask Flash Player to remove itself.`r"
$Flashutil = (Get-Childitem C:\Windows\system32\Macromed\Flash\FlashUtil*ActiveX.exe -name)
$FlashTest = (Test-Path C:\Windows\system32\Macromed\Flash\FlashUtil*ActiveX.exe)
$Flashutil1 = (Get-Childitem C:\Windows\system32\Macromed\Flash\FlashUtil*Plugin.exe -name)
$FlashTest1 = (Test-Path C:\Windows\system32\Macromed\Flash\FlashUtil*Plugin.exe)
IF ($FlashTest -eq $True)
{
Start-Process -FilePath "C:\Windows\system32\Macromed\Flash\$Flashutil" -Argumentlist "-uninstall" -ErrorAction SilentlyContinue
Write-host "Successfully ran ActiveX Uninstaller`r"
}
ELSE
{
Write-Host "ActiveX Plugin is Not coming off nicely`r"
}
IF ($FlashTest1 -eq $True)
{
Start-Process -FilePath "C:\Windows\system32\Macromed\Flash\$Flashutil1" -Argumentlist "-uninstall" -ErrorAction SilentlyContinue
Write-host "Successfully ran NPAPI Uninstaller`r"
}
ELSE
{
Write-Host "NPAPI plugin is Not coming off nicely`r"
}
#When MSIEXEC is running it causes problems with the installation of Flash, there for I am having it forcivly end it, if it is running.
Write-Host "Attempting to Terminate msiexec.exe`r"
$Process = Get-Process msiexec -ErrorAction SilentlyContinue
if ($Process -eq $True) {Stop-Process - msiexec -Force -ErrorAction SilentlyContinue}
#These are the GUIDs of each version of FlashPlayer and they can be found by Searching "Flash Player" in this Key: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
#There is one for the ActiveX and one for NPAPI Plugin
#When Building a new Flash Plackage you just need to add the 2 new GUIDs to this list.
$GUID = @("{56680CC0-AA4D-47DB-A1A3-B26A97F1D3F1}",
"{22AF9D99-A980-4071-A0BD-1D0BB956B9EA}",
"{1D95F7C4-A547-4FC9-91A4-A35B19F597C0}",
"{D633DF27-FC9E-4FDA-A158-CB36AE83671D}",
"{58E533B1-9B29-432D-BB38-25B489C1D53B}",
"{9B0163AC-7E34-4A2F-A3E6-73440FF9549B}",
"{0A9A57A9-8D6E-4CBD-9434-A244E94D2154}",
"{559A2FA4-4858-46E7-BD02-68C15A31DF98}",
"{6E6D2BB7-B844-4842-B62D-0A7F0AA7884E}",
"{CE102F76-8858-4CA8-B500-030C9A735C8A}",
"{26E87568-C135-4C53-A3D9-62EC26C2D7A1}",
"{07ABFA96-7AFE-43C2-9BC2-1005C24D2316}",
"{3898EF12-76AA-4116-BFCE-EA063420B9E2}",
"{84562166-378E-40C3-8937-FEAB57BD34C1}",
"{CCF44D05-A254-49E9-A024-33D37C37962D}",
"{7754B002-6B0F-4343-AAB9-20615AE6D7E1}",
"{401B651E-4CCC-4177-B16D-1B88EC9FDFB3}",
"{B4A59659-1E69-4286-8885-3D0618B84894}",
"{37CFB473-A66E-490E-8ED2-07C984BC42F5}",
"{8C3EAB4F-199B-456B-9840-9A95FDBAE125}",
"{D0AFDE5A-16FE-40B0-908D-63A5F23A3E7F}",
"{B2239F96-D221-45C4-81C7-386E9DB84DEB}",
"{4B4910C8-4D59-4AC2-9E72-15B9D91CEBB2}",
"{87FB4D1F-413A-4F3F-AAD9-0B130A02BA61}",
"{1C1655A5-8B59-421E-ABCC-9182956510DC}",
"{A7DC9721-4986-4179-BB89-A3E99545584C}",
"{92C34178-B679-4C83-AC33-7EFCE6D36E01}",
"{0608F2B6-4E49-4AD0-9128-C122A34CFCE1}",
"{7B0961DB-15EB-41AF-85DA-C296924CA408}",
"{7898389E-2B8F-4CAC-A8CB-489B7B339C03}",
"{FB7D053D-9F6F-4E16-96BE-D2EF54C620AC}",
"{8B4393AD-53A8-4895-803D-3AEECD99D620}",
"{D21D7AFD-8DF3-4EF0-B81B-A2AA5AEFE713}",
"{0C942CD9-6F38-498A-808F-C76EDBBA1969}",
"{89D2A20B-74C2-4A70-B598-AA4F4DFC0EBF}",
"{1F427911-1A3C-4264-967B-7DE6070FD8FC}",
"{FDAF247B-4ADD-4089-A799-B08206B8E75C}",
"{AC08189D-DBCB-40DB-8B36-0AC5F1B115BD}",
"{70F0F88A-387B-40EB-93BD-9877DB9D668D}",
"{A186F2B3-64FC-4A3C-8096-B002A71F2A9B}",
"{EE56217C-B3F9-402B-B4EC-63F090F51D3D}",
"{2F881898-5300-4D68-AE46-F5FE074D59AA}",
"{44CF4DB9-707A-4395-839C-573FBC206CB9}",
"{A6FB0BFC-1F3F-42E0-BEAB-FA139FB54812}",
"{A580818A-6519-4120-AB1C-F4F6FCFAA7D0}",
"{A4488E5C-1022-432A-8066-72E1C4023310}",
"{9F5C6A1A-3B30-4AD5-B998-2885AA7C26A7}",
"{2448A347-6E10-4FDE-AD25-74804743D184}",
"{901E9B21-CDB1-4C4A-ABFC-61A554912BED}",
"{B0069674-D80C-48CB-852D-88AD36EAB0A5}",
"{57B3953E-BB96-418D-9228-57B7082B921A}",
"{76CF5170-31B4-490F-89CE-5820EF416822}",
"{B3DADA45-F0ED-48FD-946E-7E82C2229D59}",
"{448D7DEC-36F1-4091-B419-C5487BDEB867}",
"{7AF47D49-5F6B-4646-84FA-5802C635B082}",
"{DE3DB02A-3402-4CC4-AF65-B52AE8406739}",
"{D10AEF4A-DD94-4F6C-9CBF-580C1A1F6D05}",
"{9755D61E-3FC8-479D-BAD7-5516E0FE5281}",
"{AD6E9D76-C6AA-4F6E-8DAE-4EEE78B78743}",
"{8656EDBE-7C0A-4945-8D49-493FDBE7B5BD}",
"{521CCA6C-F8FD-47ED-AF9A-2461352E34DD}",
"{0699CBD6-FFF5-4211-97A7-9C32E744F5F4}",
"{BD2339D5-5609-4DB0-A89F-D427B7B353E1}",
"{63A147A7-55F5-4305-A09C-696781D58B8A}",
"{5682D3D7-0E22-4AC5-8DAD-5375A1F7B313}",
"{BABDDB46-341A-460E-8F65-83C9B0BF7329}",
"{AA4C5C0F-AE8D-4760-A513-F2F3109D8C9E}",
"{2755BEE9-F03B-4FB8-BB71-0BA3F2629F18}",
"{506B121D-1B93-484D-8241-6250BCB736C7}",
"{44C61B0B-3700-4AA6-AC7C-EE8F0BA9A907}",
"{4EF54F47-BD29-4049-AEAF-A80E494A6A45}",
"{F22C3C05-B1D9-47FF-AA17-4F9DCBFE850F}",
"{8C901387-B304-404D-93C0-E2E0C2D53D90}",
"{61F2FFE4-56BA-4F5E-91FB-BD34F92E44CE}",
"{B21D5938-6B90-408B-B827-92F6E0E11B48}",
"{70F97130-DBF6-4885-854C-CC7A80FC65E1}",
"{DC0C27E6-745B-4D0E-A2F7-47676BFAE25D}",
"{2BE0DC49-FA94-4853-A62A-F1E02ECAA67E}",
"{D901557E-8AF2-4F66-BE3C-B8C816397BD5}",
"{465571A6-29A2-4D39-B77D-3A1F6C964B65}",
"{1D55DE93-486D-40F7-88F3-CF08578F82AA}",
"{68BC8140-3FAA-4419-B6EE-CCF60BE6DAB2}",
"{10F0B906-1989-4F20-A93C-4C0F94C8DF9E}",
"{6CBBF19C-2B69-4143-81C4-D5B56D32088C}",
"{047904BA-C065-40D5-969A-C7D91CA93D62}",
"{BC8AC77D-6A6F-491F-BEED-2958F09C6CAE}",
"{AF82C1A9-56DC-4CCD-A36C-CAE56D541DFA}",
"{3CA17ADC-2146-49C2-A375-972BB57CF7F6}",
"{7C548501-3501-468A-A443-CC42F5B3626B}",
"{F1410A0A-8205-4D45-BF2B-9C7ACB2F4B24}",
"{C4B32291-F7B2-4BEC-BA4D-4195676A08CC}",
"{3FC9A6DE-C105-4576-8F63-656FFB1BF8EB}")
#These are the SIDs of each version of FlashPlayer and they can be found by Searching "Flash Player" in this Key: HKLM:\SOFTWARE\CLASSES\Installer\Features\.
#There is one for the ActiveX and one for NPAPI Plugin.
#When Building a new Flash Plackage you just need to add the 2 new SIDs to this list.
$SID = @("3958907FC4F2C234CAF8D696CDE9DF9C",
"4C7F59D1745A9CF4194A3AB5915F790C",
"68FB4E4C72E4B8B4B89F5AFBC157374A",
"88A5DA2B41709D446828DEEC7176C1FD",
"F2E02C08FE4B8E44FBA4A626A5A91F86",
"0CC08665D4AABD741A3A2BA6791F3D1F",
"99D9FA22089A17040ADBD1B09B659BAE",
"4C7F59D1745A9CF4194A3AB5915F790C",
"72FD336DE9CFADF41A85BC63EA3876D1",
"1B335E8592B9D234BB83524B981C5DB3",
"CA3610B943E7F2A43A6E3744F09F45B9",
"9A75A9A0E6D8DBC449432A449ED41245",
"7BB2D6E6448B24846BD2A0F7A07A88E4",
"67F201EC85888AC45B0030C0A937C5A8",
"86578E62531C35C43A9D26CE622C7D1A",
"69AFBA70EFA72C34B92C01502CD43261",
"67F201EC85888AC45B0030C0A937C5A8",
"21FE8983AA676114FBECAE6043029B2E",
"50D44FCC452A9E940A42333DC77369D2",
"66126548E8733C049873EFBA75DB431C",
"E156B104CCC477141BD6B188CEF9FD3B",
"200B4577F0B63434AA9B0216A56E7D1E",
"95695A4B96E168248858D360818B8449",
"374BFC73E66AE094E82D709C48CB245F",
"F4BAE3C8B991B6548904A959DFAB1E52",
"A5EDFA0DEF610B0409D8365A2FA3E3F7",
"8C0194B495D42CA4E927519B9DC1BE2B",
"69F9322B122D4C54187C83E6D98BD4BE",
"F1D4BF78A314F3F4AA9DB031A020AB16",
"5A5561C195B8E124BACC1928595601CD",
"0418CB86AAF391446BEECC6FB06EAD2B",
"1279CD7A68949714BB983A9E595485C4",
"19223B4C2B7FCEB4ABD4145976A680CC",
"1E36145BD4A3BEE4189FAF44B9E3831B",
"39ED55D1D6847F04883FFC8075F828AA",
"4769600BC08DBC8458D288DA63AE0B5A",
"4EFF2F16AB65E5F419BFDB439FE244EC",
"54ADAD3BDE0FDF8449E6E7282C22D995",
"5E8B1F381BB60934C9712D391F430FEB",
"609B0F01989102F49AC3C4F0498CFDE9",
"6B2F806094E40DA419821C223AC4CF1E",
"87143C29976B38C4CA33E7CF6E3DE610",
"898188F2003586D4EA645FEF70D495AA",
"9BD4FC44A707593438C975F3CB02C69B",
"9DC249C083F6A89408F87CE6BDAB9196",
"A818085A91560214BAC14F6FCFAF7A0D",
"B02A2D982C4707A45B89AAF4D4CFE0FB",
"B0B16C4400736AA4CAC7EEF8B09A9A70",
"C5E8844A2201A2340866271E4C203301",
"C71265EE9F3BB2044BCE360F095FD1D3",
"C91FBBC696B23414184C5D5BD62380C8",
"CED7D8441F6319044B915C84B7ED8B76",
"CFB0BF6AF3F10E24EBBAAF31F95B8421",
"D350D7BFF6F961E469EB2DFE456C02CA",
"DFA7D12D3FD80FE48BB12AAAA5FE7E31",
"ED6A9CF3501C6754F83656F6BFB18FBE")
#Removing all the records for any previous version.
Write-Host "Removing the Macromedia Key $(get-date -format `"yyyyMMdd_hhmmsstt`")`r"
$flash1 = (Test-Path -Path "HKLM:\SOFTWARE\Macromedia\FlashPlayer")
$Flash2 = (Test-Path -Path "HKLM:\SOFTWARE\WOW6432Node\Macromedia\FlashPlayer")
$Flash5 = (Test-Path -Path "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX")
if ($Flash1 -eq $True) {Write-Host "Successfully Deleted HKLM:\SOFTWARE\Macromedia\FlashPlayer `r"
Remove-Item -path "HKLM:\SOFTWARE\Macromedia\FlashPlayer" -Recurse -ErrorAction SilentlyContinue}
if ($Flash2 -eq $True) {Write-Host "Successfully Deleted HKLM:\SOFTWARE\WOW6432Node\Macromedia\FlashPlayer`r"
Remove-Item -path "HKLM:\SOFTWARE\WOW6432Node\Macromedia\FlashPlayer" -Recurse -ErrorAction SilentlyContinue}
if ($Flash5 -eq $True) {Write-Host "Successfully Deleted HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX`r"
Remove-Item -path "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX" -Recurse -ErrorAction SilentlyContinue}
Write-Host "Searching for and deleting any previous version of Flash. $(get-date -format `"yyyyMMdd_hhmmsstt`")`r"
foreach ($GUIDS in $GUID)
{
$regPath2= "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$GUIDS"
$value2 = (Test-Path $regpath2)
$regPath64= "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$GUIDS"
$value64 = (Test-Path $regpath64)
if ($value2 -eq $True) {Write-Host "Successfully Deleted $Regpath2`r"
Remove-Item -path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$GUIDS" -Recurse -ErrorAction SilentlyContinue}
if ($value64 -eq $True) {Write-Host "Successfully Deleted $Regpath64`r"
Remove-Item -path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$GUIDS" -Recurse -ErrorAction SilentlyContinue}
#I couldnt get this one to check whether the file exists because its a value instead of a key, so I am just suppressing errors and having it try to delete any of the versions.
$UIPath = "C:\Windows\Installer\$GUIDS\"
Remove-ItemProperty -Path "hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders" -name $UIPath -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "hklm:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer\Folders" -name $UIPath -ErrorAction SilentlyContinue
}
Write-Host "Deleted all the GUIDs that were present, now searching for and deleting SIDs. $(get-date -format `"yyyyMMdd_hhmmsstt`")`r"
foreach ($SIDS in $SID) {
$sidpath1 = "HKLM:\SOFTWARE\CLASSES\Installer\Features\$SIDS"
$Sidtest1 = (Test-Path $Sidpath1)
if ($sidtest1 -eq $True){Write-Host "Successfully Deleted $sidpath1`r"
Remove-Item -path $sidpath1 -Recurse -ErrorAction SilentlyContinue}
$Sidpath2 = "HKLM:\SOFTWARE\Classes\Installer\Products\$SIDS"
$Sidtest2 = (Test-Path $Sidpath2)
if ($sidtest2 -eq $True){Write-Host "Successfully Deleted $sidpath2`r"
Remove-Item -path $sidpath2 -Recurse -ErrorAction SilentlyContinue}
$Sidpath3 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$SIDS"
$SidTest3 = (Test-Path $Sidpath3)
if ($sidtest3 -eq $True){Write-Host "Successfully Deleted $sidpath3`r"
Remove-Item -path $sidpath3 -Recurse -ErrorAction SilentlyContinue}
$Sidpath4 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\$SIDS"
$Sidtest4 = (Test-Path $Sidpath4)
if ($sidtest4 -eq $True){Write-Host "Successfully Deleted $sidpath4`r"
Remove-Item -path $sidpath4 -Recurse -ErrorAction SilentlyContinue}
$sidpath641 = "HKLM:\SOFTWARE\Wow6432Node\CLASSES\Installer\Features\$SIDS"
$Sidtest641 = (Test-Path $Sidpath1)
if ($sidtest641 -eq $True){Write-Host "Successfully Deleted $sidpath1`r"
Remove-Item -path $sidpath641 -Recurse -ErrorAction SilentlyContinue}
$Sidpath642 = "HKLM:\SOFTWARE\Wow6432Node\Classes\Installer\Products\$SIDS"
$Sidtest642 = (Test-Path $Sidpath642)
if ($sidtest642 -eq $True){Write-Host "Successfully Deleted $sidpath642`r"
Remove-Item -path $sidpath642 -Recurse -ErrorAction SilentlyContinue}
$Sidpath643 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$SIDS"
$SidTest643 = (Test-Path $Sidpath3)
if ($sidtest643 -eq $True){Write-Host "Successfully Deleted $sidpath643`r"
Remove-Item -path $sidpath643 -Recurse -ErrorAction SilentlyContinue}
$Sidpath644 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\$SIDS"
$Sidtest644 = (Test-Path $Sidpath644)
if ($sidtest644 -eq $True){Write-Host "Successfully Deleted $sidpath644`r"
Remove-Item -path $sidpath644 -Recurse -ErrorAction SilentlyContinue}
}
#Now Just to run the installs
Write-Host "Flash is removed"
Stop-Transcript
Comments:
-
Hello Swheeler911. Could you please show how to run this script in KACE? I am a newbie with scripting via KACE and not sure how to run this. Thank you. - edem 3 years ago
Comments:
-
Most versions have this command in the uninstall registry branch......
"C:\Windows\SysWOW64\Macromed\Flash\FlashUtil32_??_?_?_???_ActiveX.exe -maintain activex"
The..... _??_?_?........is where the different version Numbers are
how do I uninstall with this command for all the versions of flash? - akmagnum 8 years ago-
The old versions will uninstall automatically when you install the new version. I checked this on a test system as I'm looking to script this in conjunction with Chocolatey and Powershell for the v27 vulnerability fixes.
The downloaded old program installs automatically uninstall the old version first, as does the Chocolatey install when you do "choco upgrade flashplayer#### -y".
The program files all use the same name but with the version number in the file name, so you can use Get-Item (gi) with a * for the version name, and sort it by creation time so that the most recent one is selected, that way you can use the precise name of the file to get the file version regardless of which number version is installed.
Here's what I was looking at for sample code
#simplified array
$ActiveX = @(((gi C:\Windows\System32\Macromed\Flash\FlashUtil*ActiveX.exe | Sort CreationTime | Select -Last 1).FullName),"flashplayeractivex")
$NPAPI = @(((gi C:\Windows\System32\Macromed\Flash\FlashUtil*Plugin.exe | Sort CreationTime | Select -Last 1).FullName),"flashplayerplugin")
$PPAPI = @(((gi C:\Windows\System32\Macromed\Flash\FlashUtil*pepper.exe | Sort CreationTime | Select -Last 1).FullName),"flashplayerppapi")
$flash=@($ActiveX,$NPAPI,$PPAPI)
foreach ($plugin in $flash)
{
if(Test-Path $plugin[1]){ #if present check file version and update to v27
if ((Get-Command $plugin[1]).FileVersionInfo.Fileversion -lt "27,0,0,130")
{
if(Test-Path C:\ProgramData\chocolatey\choco.exe){} #confirm chocolatey is installed
else { iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) } #install Chocolatey if it isn't
saps -Wait C:\ProgramData\chocolatey\choco.exe -ArgumentList ("upgrade $plugin[2] -y --force") #install v27 of previously installed plugin
}
}
} - cdum 6 years ago