Not a problem at all, i know all of us here are more then glad to be of help. I picked up this script before but never tried it as I had other deplicate entries. In your case, I see there would be a need for it.
This script searches through the pre-determined file for a text and copies all other lines not matching that text to the temp file. At the end of the script, it deletes the original and renames the new.
good luck 🙂
Set FSO = CreateObject("Scripting.FileSystemObject")
CfgPath = Session.Property("SystemFolder") & "drivers\etc\hosts"
CfgTmp = "C:\Winnt\System32\Drivers\Etc\hosts.tmp"
Set Fin = FSO.OpenTextFile(CfgPath, 1, False, 0)
Set Fout = FSO.CreateTextFile(CfgTmp, false, false)
Do While Fin.AtEndOfStream <> True
szLine = Fin.ReadLine
' "NTSDTELCO1007A NTSDTELCO1007A #NTSDTELCO1007A" is the line added
if (szLine <> "NTSDTELCO1007A NTSDTELCO1007A #NTSDTELCO1007A") then
Fout.WriteLine szLine
end if
Loop
Fin.Close
Fout.Close
FSO.DeleteFile CfgPath, true
FSO.MoveFile CfgTmp, CfgPath
Set Fin = Nothing
Set Fout = Nothing
Set FSO = Nothing