tehon3299 Posted June 30, 2004 Share Posted June 30, 2004 I just finished writing my BETA script to change a computers hostname. This script will do an nslookup on the ip address of your computer and parse out the hostname it returns. Then it changes 4 registry settings that affect the hostname. Once that is done, you need to reboot and your hostname will now be changed. You can open a command prompt and type 'hostname' to see your hostname. You can download this script from http://www.oswego.edu/~tehonica/hostname_changer.exeRemember, this is a beta script. Please post all feedback you have!Thanks! Link to comment Share on other sites More sharing options...
emmanuel Posted June 30, 2004 Share Posted June 30, 2004 it just changes the hostname? so nothing to do with workgroup or domain membership? Can we see the source? "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
autoitNOW Posted July 1, 2004 Share Posted July 1, 2004 Hi, I would like to see the source too. An ADVOCATE for AutoIT Link to comment Share on other sites More sharing options...
emmanuel Posted July 1, 2004 Share Posted July 1, 2004 just decompiled the exe...; <COMPILER: v3.0.101.0> $IP = @IPAddress1 RunWait(@Comspec & " /c """ & "nslookup "" " & $IP & " > hostname.txt") $file = FileOpen("hostname.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $line = FileReadLine($file, 4) FileClose($file) $array = StringSplit($line, ":.") $hostname = $array[2] $hostname = StringReplace($hostname, " ", "") RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $hostname) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $hostname) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $hostname) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $hostname) MsgBox(0, "Done", "Done") "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now