Hi All - I’m trying to edit the host file at “C:\WINDOWS\system32\drivers\etc” and need to just simply add an additional line with IP address to host name. This is what I came up with:
continue if {(size of it = 488 AND sha1 of it = “0329bc06a6bc4795500d6cca6835dff2a4b122a3”) of file “hosts.tmp” of folder “__Download”}
extract hosts.tmp
delete __Download\hosts.tmp
copy “__Download\hosts.tmp” “{name of drive of windows folder}\WINDOWS\system32\drivers\etc\hosts.tmp”
Log Error:
"Command failed (Copy of ‘__Download\hosts.tmp’ to ‘C:\WINDOWS\system32\drivers\etc\hosts.tmp’ failed (2)) copy “__Download\hosts.tmp” “C:\WINDOWS\system32\drivers\etc\hosts.tmp” (fixlet 4223)
I believe this error means it cannot add new host file because the original still exists. What is the action script to delete the original hosts file and then replace with new one I created? Or is there an easier way to do this?
continue if {(size of it = 488 AND sha1 of it = “0329bc06a6bc4795500d6cca6835dff2a4b122a3”) of file “hosts.tmp” of folder “__Download”}
extract hosts.tmp
delete __Download\hosts.tmp
move “{name of drive of windows folder}\WINDOWS\system32\drivers\etc\hosts” “{name of drive of windows folder}\WINDOWS\system32\drivers\etc\hosts.backup”
copy “”{(pathname of client folder of current site)}__Download\hosts" “{name of drive of windows folder}\WINDOWS\system32\drivers\etc\hosts”
not exists file “hosts” whose (exists lines whose (it as left trimmed string does not start with “#” and it contains “X.X.X.X” ) of it OR exists lines whose (it as left trimmed string does not start with “#” and it as lowercase contains “hostname.com” ) of it) of folder “drivers\etc” of system folder
X.X.X.X is your IP address and hostname.com is the hostname you want to add.