You are on page 1of 3

@echo off

rem
rem REMOVE-FIREFOX-DOT-NET-EXTENSION.BAT
rem ------------------------------------
rem
rem by Matthew Borcherding
rem matt@borchtech.com
rem v.1.0 - 06/04/08

rem
rem This routine checks if Microsoft's .Net 3.5 assistant extension
rem for Firefox is installed, and if so, removes it.
rem
rem This extension is generally unneeded, unnecessary, and a security
rem vulnerability. Get rid of it!

rem
rem Information on the whole problem here:
rem
rem http://support.microsoft.com/kb/963707
rem http://technologyexpert.blogspot.com/2009/05/how-to-rid-yourself-of-
microsofts.html
rem http://blogs.msdn.com/brada/archive/2009/02/27/uninstalling-the-clickonce-
support-for-firefox.aspx

rem I just automated all of this -- making it easy to stick in a login script or
such...
rem
rem Since this relies on reg.exe, this requires WinXP or greater. (But if
rem you copy REG.EXE from a copy rem of XP into the Windows directory of a
rem 2k system, you can still run this.)
rem
rem I've tested and retested to make this silent as possible. But I'm sure
rem there's more. Please email me if you get any better
rem routines/tweaks/fixes/etc.

rem First check if on 32-bit or 64-bit system...

set bits=32bit
if /i "%programfiles(x86)%" == "c:\program files (x86)" set bits=64bit
goto %bits%

rem
rem Now check for Firefox first. (No reason to do this if Firefox not
rem installed!) If so, then check for the MS extension in the registry,
rem and remove if found.
rem

:32bit
if not exist "%programfiles%\Mozilla Firefox\firefox.exe" goto done

reg query HKLM\SOFTWARE\Mozilla\Firefox\Extensions /s > "%temp%\ff-dot-net-


check.txt"
find "DotNetAssistantExtension" "%temp%\ff-dot-net-check.txt" >nul
if not errorlevel 1 goto 32bit-remove
goto check-firefox-prefs
:32bit-remove
reg DELETE HKLM\SOFTWARE\Mozilla\Firefox\Extensions /v {20a82645-c095-46ed-
80e3-08825760534b} /f > nul
goto kill-files

:64bit
if not exist "%programfiles(x86)%\Mozilla Firefox\firefox.exe" goto done

reg query HKLM\SOFTWARE\Wow6432Node\Mozilla\Firefox\Extensions /s > "%temp%\ff-


dot-net-check.txt" > nul
find "DotNetAssistantExtension" "%temp%\ff-dot-net-check.txt" >nul
if not errorlevel 1 goto 64bit-remove
goto check-firefox-prefs

:64bit-remove
reg DELETE HKLM\SOFTWARE\Wow6432Node\Mozilla\Firefox\Extensions /v {20a82645-
c095-46ed-80e3-08825760534b} /f >nul

:kill-files

rem
rem Now delete the extension files as well (routine is the same for both
rem 32-bit and 64-bit)
rem

rd /s /q "%SYSTEMDRIVE%\Windows\Microsoft.NET\Framework\v3.5\Windows
Presentation Foundation\DotNetAssistantExtension" > nul

echo Microsoft .NET Framework assistant extension for Firefox found and
removed.
echo (This is an unneeded extension and a serious security vulnerability.)
echo.

:check-firefox-prefs
rem
rem Now remove the traces in the Firefox preferences
rem
rem Running this again even if files/registry updated, as this could be
rem orphaned in the prefs of other Windows user profiles
rem
rem This uses some routines from "Fakeaol" here:
rem http://www.annoyances.org/exec/forum/winxp/1242939406

pushd "%appdata%\Mozilla\Firefox\Profiles"
for /d %%i in (*) do (
cd %%i
findstr /V "microsoftdotnet useragentswitcher.1.appname
microsoft.CLR.clickonce.autolaunch" prefs.js > prefs.new.js
move prefs.new.js prefs.js > nul
cd ..
)
popd

:cleanup
del /q "%temp%\ff-dot-net-check.txt" > nul
:done

You might also like