avhimkov
3/18/2017 - 8:11 AM

IE_Clear

IE_Clear

@echo off
setlocal enabledelayedexpansion

REM -- check XHTML support (IE 9+)
set xhtml=0
for /f %%G in ('"reg query "HKCR\IE.AssocFile.XHT" /ve 2>&1 | findstr /c:".XHT" "') do set xhtml=1

REM -- reset file extensions
set exts=HTM,HTML
if %xhtml% == 1 (set exts=%exts%,XHT,XHTML)

for %%G in (%exts%) do (
set ext=%%G
set ext=!ext:~0,3!
reg add "HKCU\Software\Classes\.%%G" /ve /t REG_SZ /d "IE.AssocFile.!ext!" /f >nul
)

set exts=%exts%,MHT,MHTML,URL
set acl=%temp%\acl_%random%%random%.txt

for %%G in (%exts%) do (
set key=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.%%G\UserChoice
echo !key! [1 7 17]>"%acl%"
regini "%acl%" >nul
set ext=%%G
set ext=!ext:~0,3!
reg add "!key!" /v "Progid" /t REG_SZ /d "IE.AssocFile.!ext!" /f >nul
)
del "%acl%" 2>nul

REM -- reset MIME associations
for %%G in (message/rfc822,text/html) do (
set key=HKCU\Software\Microsoft\Windows\Shell\Associations\MIMEAssociations\%%G\UserChoice
reg add "!key!" /v "Progid" /t REG_SZ /d "IE.%%G" /f >nul
)

REM -- reset URL protocols
for %%A in (FTP,HTTP,HTTPS) do (
set key=HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\%%A\UserChoice
reg add "!key!" /v "Progid" /t REG_SZ /d "IE.%%A" /f >nul
for %%B in (DefaultIcon,shell) do (
set key=HKCU\Software\Classes\%%A
reg delete "!key!\%%B" /f >nul 2>&1
reg copy "HKCR\IE.%%A\%%B" "!key!\%%B" /s /f >nul
reg add "!key!" /v "EditFlags" /t REG_DWORD /d 2 /f >nul
reg add "!key!" /v "URL Protocol" /t REG_SZ /d "" /f >nul
))

REM -- reset the start menu Internet link (Vista and earlier)
reg add "HKCU\Software\Clients\StartMenuInternet" /ve /t REG_SZ /d "IEXPLORE.EXE" /f

REM -- reset cached icons
if %xhtml% == 1 (
ie4uinit -cleariconcache
) else (
taskkill /im explorer.exe /f >nul
start explorer
)

exit /b
@echo off
CLS
ECHO.
ECHO =========================================
ECHO Please Run Privilege Elevation Tool First
ECHO =========================================

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)
ECHO.
ECHO ******************************************
ECHO Please Run Privilege Elevation Tool First
ECHO ******************************************

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs" 

cmdkey.exe /list > "%TEMP%\List.txt"
findstr.exe Target "%TEMP%\List.txt" > "%TEMP%\tokensonly.txt"
FOR /F "tokens=1,2 delims= " %%G IN (%TEMP%\tokensonly.txt) DO cmdkey.exe /delete:%%H
del "%TEMP%\*.*" /s /f /q

taskkill.exe /F /IM iexplore.exe /T

rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

rundll32 inetcpl.cpl ResetIEtoDefaults

gpupdate.exe /force
pause
$ComputerName = Read-Host ″Enter remote computer name″
$credential = Get-Credential
Get-WMIObject Win32_Process -filter ‘name=″explorer.exe″’ -computername $computername -Credential $credential |
ForEach-Object {
$owner = $_.GetOwner()
‘{0}\{1}’ -f $owner.Domain, $owner.User} |
Sort-Object |
Get-Unique |
ForEach-Object {
$rv = 1 | Select-Object ComputerName, User
$rv.ComputerName = $computername
$rv.User = $_
$rv
}