Link to home
Start Free TrialLog in
Avatar of bigfig
bigfig

asked on

HELP! Controlling NIC - Disable without/Reboot

Hi All,

I'm setting up a HA web configuration, where we are using Double Take software to allow us to fail over to a stand-by server when the primary acts up.  It works well when the primary fails hardware or network wise, but when a NT service or application is bad and the OS is running OK, we want to fail over with Double Take.  Now if we execute Double Take fail over, it leaves us with two servers running with the same IP address.  Big problem, right?

What I'm looking for is a way to script an action that will disable the NIC on the primary server, so it is unable to reply to a PING.  This must be done without a reboot, very important.  Can I use an SNMP command, or edit the registry to do this?  

Thanks in advance,
Dan
daniel_figueroa@hp.com
Avatar of SysExpert
SysExpert
Flag of Israel image

All you need to do is disable the devie. I imagine a registry hack would be best.
Also you can disable a service or two if necessary using NT resource tools.
Shutdown can do a remote shutdown.
Kill can kill a process/task
Srvinst can install/uninstall a service.
Check the online help in the resource kit.
Lots of stuff to help out there !!
I hope this helps !

Avatar of bigfig
bigfig

ASKER

Regarding your suggestion on killing a process or stopping a service.  Can you tell us which process or service would best disable the network card, without rebooting the system?

Thanks,
Dan
NET STOP Server

This should do the trick!

Delete the NIC from a batch file as shown below.
Other option is to delete the TCp/IP protocol. One of them should do the trick. Other option is trying to do an IP address change on the fly.
I hope this helps.

-----------------
If you are unable to use the Remove button in Control Panel \ Network, use Regedt32 to delete:

 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\<adapter>

 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\NetworkCards\<#>
 (If only one adapter is loaded, <#> will be 1)

 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<adapter>


-----------------
To delete a key using Regedit, include a minus sign in front of the key path.

                        Assume you had the following keys and values:

                        [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Stuff]
                        "GuessWhat"="????"

                        [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Stuff\More]
                        "HostName"="NameHost"

                        [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ZipZap]
                        "GuessWhat"="????"

                        [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ZipZap\Zip]
                        "ZipZap"="ZapZip"
                        [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ZipZap\Zap]
                        "BlahBlah"="string"

                        If you wanted to delete the entire Stuff service and the Zip subkey of the ZipZap service,
                       you would
                        submit the following within a .reg file (including the proper header for your version of
                       Regedit):

                        [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Stuff]

                        [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Stuff\More]

                        [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ZipZap\Zip]

                        If the file name was c:\regdel.reg, then:

                        regedit /s c:\regdel.reg

                        where the optional /s makes it silent.
Other options are using a shell script or WSH script.
---------------------------------
When moving from site to site, it is often necessary to switch between static IP addressing and DHCP.

 This used to be a real pain.

 Using the NETSH command on my Windows 2000 laptoop, I script it, without the need to even restart.

 To implement this technique, determine what adapters / IP addresses you currently have by typing:

 NETSH interface ip show ipaddress

 If you have 2 NICs, the result would look something like:

 MIB-II IP Address Entry
 IP Address       Mask             BC Fmt  Reasm Sz  Interface
 ---------------  ---------------  ------  --------  -----------------------
 127.0.0.1        255.0.0.0             1     65535  Loopback
 192.168.0.50     255.255.255.0         1     65535  Local Area Connection
 216.144.1.126    255.255.254.0         1     65535  Internet

 NOTE: The RemoteAccess service must be started. If it is Disabled, set it to Manual or Automatic. Then type net start remoteaccess.

 To switch the Local Area Connection to DHCP, type:

 netsh interface ip set address "Local Area Connection" dhcp

 To change the Local Area Connection to a static ip address, type:

 netsh interface ip set address "Local Area Connection" static <ipaddr> <subnetmask>
 <gateway> <metric>

 where:

 <ipaddr> is the ip address.

 <subnetmask> is the subnet mask.

 <gateway> is the default gateway.

 <metric> is the metric.

 To change the Local Area Connection to 192.168.0.50, subnet mask 255.255.255.0, default
 gateway 192.168.0.1 and a metric of 1, type:

 netsh interface ip set address "Local Area Connection" static 192.168.0.50 255.255.255.0
 192.168.0.1 1
ASKER CERTIFIED SOLUTION
Avatar of Portang
Portang

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial