Dim WshShell, fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Hardlock\Parameters\AvirSpecial", 2, "REG_DWORD"

Set regEx = New RegExp 
regEx.Global = True
regEx.IgnoreCase = True   

WshShell.Run ("attrib -H -S -R c:\boot.ini")

If Not fso.FileExists( "c:\boot.bak" ) Then
fso.CopyFile "c:\boot.ini","c:\boot.bak"
end if

Set di = fso.OpenTextFile("C:\boot.ini")
stringa = di.readall


regEx.Pattern = "([\s\S]+)/NoExecute=AlwaysOff([\s\S]+)"
set found = regEx.Execute(stringa)

For Each match in found
test= match.submatches(0)
next

if (test="") then


regEx.Pattern = "([\s\S]+)/NoExecute=OptIn([\s\S]+)"
set found = regEx.Execute(stringa)

For Each match in found
a= match.submatches(0)
b= match.submatches(1)
next

if (a<>"") then

	c = a + "/NoExecute=AlwaysOff" + b
	set fso=nothing
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set di = fso.OpenTextFile("C:\boot.ini",2)
	di.Write c
	set fso=nothing

else
regEx.Pattern = "([\s\S]+)/fastdetect([\s\S]+)"
set found2 = regEx.Execute(stringa)

For Each match in found2
c= match.submatches(0)
d= match.submatches(1)
next

if (c<>"") then

	sce = inputbox ("Do you want to update the boot file ?","Select","Click on 'Cancel' to avoid")
	if sce<>"" then
		e = c + "/fastdetect /NoExecute=AlwaysOff" + d
		set fso=nothing
		Set fso = CreateObject("Scripting.FileSystemObject")
		Set di = fso.OpenTextFile("C:\boot.ini",2)
		di.Write e
		set fso=nothing
	end if 
end if

end if

end if

WshShell.Run ("attrib +H +S +R c:\boot.ini")
Msgbox ("Completed")
