' Unprotect Explorer.exe
' This script will remove Windows File Protection for Explorer.exe allowing
' it to be edited to change system graphics.
' UnprotectExplorer.vbs
' © Robert Dunham - 3/19/2007
' Downloaded from http://www.nilpo.com/pub/scripts
message = "This script provided by Nilpo.com" + vbCr + vbCr
message = message + "This script will remove Windows File Protection for the Explorer.exe file."
result = MsgBox(message, _
vbOKCancel + vbInformation + vbDefaultButton1 + vbSystemModal, _
"Unprotect Explorer.exe")
If result = vbCancel Then
WScript.Quit
End If
Set objShell = CreateObject("WScript.Shell")
strPath1 = objShell.ExpandEnvironmentStrings("%systemroot%\System32\Restore\filelist.xml")
strPath2 = objShell.ExpandEnvironmentStrings("%systemroot%\System32\dllcache\Explorer.exe")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFile = objFso.GetFile(strPath1)
objFile.Attributes = 0
Set objStream = objFile.OpenAsTextStream(1)
strData = objStream.ReadAll
objStream.Close
strFind = " %windir%\system.ini"
strAdd = " %windir%\Explorer.exe" & VbCrLf & strFind
strData = Replace(strData, strFind, strAdd)
Set objStream = objFile.OpenAsTextStream(2)
objStream.Write strData
objStream.Close
objFile.Attributes = 7
Set objFile = Nothing
If objFso.FileExists(strPath2) Then
Set objFile = objFso.DeleteFile(strPath2)
End If
WScript.Echo "The file Explorer.exe is no longer protected."