Jump to content

Change Computer Name and IP Address


bstripe
 Share

Recommended Posts

I need a program that will change a computer name and an IP address. I want the user to choose from two possiblilities. For example:

Computer Name: Inbatch1 IP address 111.1.1.1

or

Computer Name: Inbatch2 IP address 222.2.2.2

This will run on WinNT 4.0 but if I knew how to do it on Windows XP I should be able to make any needed alterations.

Thanks

Link to comment
Share on other sites

I created two buttons with logic as follow:

case $msg = $Inbatch1_btn

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName","REG_SZ", "Inbatch1")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", "Inbatch1")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", "Inbatch1")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", "Inbatch1")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\El90x1\Parameters\Tcpip","IPAddress","Reg_Binary","111.1.1.1")Exit

case $msg = $Inbatch2_btn

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName","REG_SZ", "Inbatch2")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", "Inbatch2")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", "Inbatch2")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", "Inbatch2")

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\El90x1\Parameters\Tcpip","IPAddress","Reg_Binary","32,32,32,2e,32,2e,32,2e,32,00,00")

Exit

The computer name changes but not the IP address. In the RegWrite command I have tried entering the value as shown as well as the form "111.1.1.1". As shown the registry is updated but when I go to TCP/IP properties, the IP address is blank. When I change the value using the other form ("111.1.1.1") it does not change the value in the properties or registry.

If I do a RegRead then the current IP address shows up in the form "111.1.1.1"

Link to comment
Share on other sites

Danny,

Since there were only two IP configurations, I was able to make *.reg files for the two IP addresses and then I just opened them using the run command.

run("regedit.exe filepath\filename")

Thanks for your input.

Brett

Edited by bstripe
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...