updatation of hosts file in windows xp

Discussion in 'Technical' started by mikdadhussain, Jun 1, 2007.

  1. mikdadhussain

    mikdadhussain New Member

    Hi,
    Dear All.
    . I need a kind piece of help from your side.
    Actually, the situation is that i want to make some DNS Entries updation on my windows client (running windows XP) through a Linux server, that's running NMS at the current time. I want that when the XP client accesses the NMS Web page, the "C:\WINDOWS\system32\drivers\etc\hosts" file should automatically updated with some DNS information that i want to put in it. Can some body kindly guide me through some script or some other method for this.

    Thanks and Regards.
    Shoaib Akbar.
     
  2. antinouskalisto

    antinouskalisto New Member

    HOSTS_UPDATE_ROUTINE.BAT

    Code:
    @echo off
    cd c:\WINDOWS\system32\drivers\etc\
    wget --no-check-certificate https://www.railunlimited.com/up-banned-hosts.zip
    unzip up-banned-hosts.zip
    del up-banned-hosts.zip
    move /Y up-banned-hosts.txt hosts
    
    You will need wget for windows and unzip for windows, in the C:\WINDOWS\system32 folder or add it to your %PATH% somewhere.
    http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget.exe
    http://users.ugent.be/~bpuype/wget/
    ftp://ftp.info-zip.org/pub/infozip/WIN32/unz552xn.exe
    http://www.info-zip.org/UnZip.html

    Create a hosts file using the one from the XP default file. Zip it up. Upload to webserver.

    You can have the system automaticlly update your hosts list like this...

    ADD_HOSTS_TASKS.bat

    Code:
    @echo off
    SCHTASKS /Create /SC WEEKLY /TN RegularlyUpdateBannedHosts /TR c:\WINDOWS\system32\up-banned-hosts-update.bat /RU Administrator /RP password
    SCHTASKS /Create /SC ONLOGON /TN OnLogonUpdateBannedHosts /TR c:\WINDOWS\system32\up-banned-hosts-update.bat /RU Administrator /RP password
    copy up-banned-hosts-update.bat %SYSTEMROOT%\SYSTEM32
    
    For more SCHTASKS examples, http://www.ss64.com/nt/schtasks.html

    I hope you enjoy this, I wrote it just a few days a go. :D
     

Share This Page