This works for me: Local $sUserName = "xxxx"
Local $sPassword = "xxxx"
Local $sHostFile = "C:\Windows\System32\drivers\etc\hosts"
RunAs($sUserName,@computername,$sPassword,0,"attrib -s -h -r " & $sHostFile)
;RunAs($sUserName,@computername,$sPassword,0,"echo xxx.xxx.xxx.xxx www.google.com" & @CRLF)
$hFile = FileOpen($sHostFile, $FO_APPEND)
FileWrite($hFile,"echo xxx.xxx.xxx.xxx www.google.com" & @CRLF)
FileClose($hFile)
Run("Notepad.exe " & $sHostFile)
RunAs($sUserName,@computername,$sPassword,0,"attrib +s +h +r " & $sHostFile)