3 Replies Latest reply on Feb 22, 2015 10:57 AM by dblansky

    Does anyone have a script to remove all Google chrome products and reset the Internet Explores back to default.

    Apprentice

      Does anyone have a script to remove all Google chrome products and reset the Internet Explores back to default? Either by batch/cmd or PowerShell.

        • 1. Re: Does anyone have a script to remove all Google chrome products and reset the Internet Explores back to default.
          Specialist

          These are the 3 files I have in place.  I have the Pinned Start Menu icon remain despite the cleanup in the VBS file, but it does the job of removing chrome & setting IE to default.  When I have some time to sort through things I may do some additional testing to try to identify what needs to be changed to remove the start bar icon.

           

          batch:

          @echo off

          taskkill /F /IM chrome.exe /T

          pushd %~dp0

          cscript chrome_rmv.vbs

          regedit.exe /s Chrome_rmv.reg

           

          ------------------------------------------------------------------------------------------------------------------------------------------------------

           

          VBS - chrome_rmv.vbs :

           

           

          '~~~~~~~~~~~~~~~vbs script~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          'This script will look through all user profiles and delete:

          ' chrome application folder ( leaving behind the user data folder in case it is a legit install

          ' shortcut located on desktop, if exists

          ' quick launch shortcut if it exists

          'this is to perform a manual uninstall of chrome

          ' ----------------------------------------------------------

           

          Option Explicit

           

          Dim objWshShell, objFSO

          Dim strAllUsersDesktopPath, strUserProfilesMainFolder

          Dim strScriptFileDirectory, SystemDrive

          dim Chromeapp, Desktop, quicklaunch, loadregistry, regfile

          Dim objwmiservice, colprocesslist, objprocess

          dim tempdir, subfolder2, temppaths

          Set objWshShell = WScript.CreateObject("WScript.Shell")

          Set objFSO = CreateObject("Scripting.FileSystemObject")

           

          'On Error Resume Next

           

          'close chrome if it is open

          closechrome

           

          ' Sets script variables and objects.

          SetScriptItems

           

          ' finds the files and folders and deletes them

          findfolder

           

          Wscript.Quit

           

          ' ----------------------------------------------------------

          '            FUNCTIONS & SUBROUTINES

          ' ----------------------------------------------------------

           

          ' ----------------------------------------------------------

          Sub closechrome

           

          dim target_process,strcomputer

          'target process is name of process you wish to terminate.  include extemsion (.exe).  Also enclose process in quotes

          target_process= "chrome.exe"

          strComputer = "."

           

          Set objWMIService = GetObject("winmgmts:" _

            & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

          ' this portion of the next line ='" & target_process & "'") is = <single quote> <double quote> & target_process & <double quote> <single quote> <double quote>

          Set colProcessList = objWMIService.ExecQuery _

            ("SELECT * FROM Win32_Process WHERE Name ='" & target_process & "'")

          For Each objProcess in colProcessList

             objProcess.Terminate()

          Next

          wscript.sleep 5000

          End Sub

           

          Sub SetScriptItems

          ' Attempts to set the variables and objects that might be needed by the script (not all variables may be used by the script).

          strScriptFileDirectory = objFSO.GetParentFolderName(wscript.ScriptFullName)

          SystemDrive = objWshShell.ExpandEnvironmentStrings("%SystemDrive%")

           

          ' Attempts to obtain the Desktop path for all users.

          strAllUsersDesktopPath = objWshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Desktop")

           

          ' Attempts to configure Windows XP paths.

          strUserProfilesMainFolder = Mid(strAllUsersDesktopPath,1,InStr(strAllUsersDesktopPath, "\All Users"))

          If strUserProfilesMainFolder = "" Then

                  ' Attempts to configure Windows Vista paths.

                  strUserProfilesMainFolder = Mid(strAllUsersDesktopPath,1,InStr(strAllUsersDesktopPath, "\Public"))

          End If

          End Sub

           

          ' ----------------------------------------------------------

          Sub findfolder

          ' Loads the individual user profile hives and configures needed USER registry settings.

          Dim UserPaths, Subfolder, strSetRegistry, strRegPath ,username

           

          Set UserPaths = objFSO.GetFolder(strUserProfilesMainFolder).Subfolders

           

          For Each Subfolder in UserPaths

                  username = Subfolder.Name

                  loadregistry = "no"

                  strRegPath="unknown"

          'set paths

          chromeapp = subfolder & "\Local Settings\Application Data\Google\Chrome\application"

          desktop = subfolder & "\Desktop\Google Chrome.lnk"

          quicklaunch = subfolder & "\Application Data\Microsoft\Internet Explorer\Quick Launch\Google Chrome.lnk"

           

          'If the path chromeapp exists, chrome is installed to user profile, and we will remove it manually

          if  objfso.FolderExists(chromeapp) Then

                  'wscript.echo "chrome found for " & username

                  objfso.deletefolder chromeapp

           

                  'set this to yes so we can load the ntuser.dat and delete the reg keys

                  loadregistry = "yes"

          end if

           

          'check for desktop shortcut, and remove

          IF objFSO.FileExists(desktop) THEN

                  'wscript.echo "desktop shortcut exists for " & username

                  objFSO.DeleteFile(desktop)

          end if

           

          'check for quick launch shortcut and remove

          IF objFSO.FileExists(quicklaunch) THEN

                  'wscript.echo "quicklaunch shortcut exists for " & username

                  objFSO.DeleteFile(quicklaunch)

          end if

           

          'if chrome was found in a profile, load the ntuser.dat for that user, and merge this reg file to remove registry keys associated with it

          if loadregistry = "yes" then

                  regfile = "remove-chrome.reg"

                  

                  ' Loads the user profile's registry hive.

                  objWshShell.Run ("Reg.exe load HKEY_USERS\CustomizeRegistry """ & Subfolder & """\NTuser.dat"), 0, True

                  

                  'merge the reg file that deletes the reg keys

                  objwshShell.Run "regedit.exe /s " & Chr(34) & RegFile & Chr(34), 0, True

                  

                  'Unloads the user profile registry hive.

                  objWshShell.Run ("Reg.exe unload HKEY_USERS\CustomizeRegistry"), 0, True

          End if

           

          'see if chrome exists in temp dirs

          tempdir= subfolder &"\Local Settings\Temp\"

           

          if  objfso.FolderExists(tempdir) Then

           

                  Set tempPaths = objFSO.GetFolder(tempdir).Subfolders

                  For Each Subfolder2 in tempPaths

           

                          If InStr(1, subfolder2.Name, "chrome", 1) > 0 Then

                          objfso.deletefolder subfolder2.path

                          end if

                  Next

          end if

          Next

          End Sub

           

          -----------------------------------------------------------------------------------------------------------------------------------------------------

           

          Reg - Chrome_rmv.reg :

           

           

          Windows Registry Editor Version 5.00

           

           

          ; WARNING, this file will remove Google Chrome registry entries  

          ; from your Windows Registry. Consider backing up your registry before

          ; using this file: http://support.microsoft.com/kb/322756

          ;HKEY_USERS\CustomizeRegistry

          ; To run this file, save it as 'remove.reg' on your desktop and double-click it.

           

           

          [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ChromeHTML]

          [-HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\chrome.exe]

          [HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]

          "Chrome"=-

           

           

           

           

          [-HKEY_USERS\CustomizeRegistry\SOFTWARE\Classes\ChromeHTML]

          [-HKEY_USERS\CustomizeRegistry\SOFTWARE\Clients\StartMenuInternet\chrome.exe]

          [HKEY_USERS\CustomizeRegistry\SOFTWARE\RegisteredApplications]

          "Chrome"=-

           

           

          [-HKEY_USERS\CustomizeRegistry\Software\Microsoft\Windows\CurrentVersion\Uninstall\Chrome]

          [-HKEY_USERS\CustomizeRegistry\Software\Google\Update\Clients\{8A69D345-D564-463c-AFF1-A69D9E530F96}]

          [-HKEY_USERS\CustomizeRegistry\Software\Google\Update\ClientState\{8A69D345-D564-463c-AFF1-A69D9E530F96}]

           

           

          [-HKEY_USERS\CustomizeRegistry\Software\Google\Update\Clients\{00058422-BABE-4310-9B8B-B8DEB5D0B68A}]

          [-HKEY_USERS\CustomizeRegistry\Software\Google\Update\ClientState\{00058422-BABE-4310-9B8B-B8DEB5D0B68A}]

           

           

          [-HKEY_LOCAL_MACHINE\SOFTWARE\Google\Update\ClientStateMedium\{8A69D345-D564-463c-AFF1-A69D9E530F96}]

          [-HKEY_LOCAL_MACHINE\SOFTWARE\Google\Update\Clients\{8A69D345-D564-463c-AFF1-A69D9E530F96}]

          [-HKEY_LOCAL_MACHINE\SOFTWARE\Google\Update\ClientState\{8A69D345-D564-463c-AFF1-A69D9E530F96}]

           

           

          [-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Update\Clients\{8A69D345-D564-463c-AFF1-A69D9E530F96}]

          • 3. Re: Does anyone have a script to remove all Google chrome products and reset the Internet Explores back to default.
            Specialist

            happy to help!

            I know its not the cleanest process, but it did the job for me also, so I haven't focused too much time on streamlining it.