Automated script to assign TCP/IP settings automatically after unintentionally unplug


 
Thread Tools Search this Thread
Special Forums IP Networking Automated script to assign TCP/IP settings automatically after unintentionally unplug
# 1  
Old 02-06-2009
Automated script to assign TCP/IP settings automatically after unintentionally unplug

Yesterday i had a situation that cause me headache for a while , I have a web server running win2k3 it has 2 NIC's
one of them assigned to public area network
and the other is not functioning
The place where the server is ,
is messy and cables on the floor so any one can stumble with
cables on the floor and indeed it happened somebody stumbled with the cable and unplugged it form the functioning NIC adapter when s/he returned the cable s/he didn't return it to the right functioning NIC adapter by the way both NIC are enabled
So i made a little trip to place where the server is and begun to do some troubleshooting if you can visualize the situation the unfunction NIC is enabled and it has private ip address so the the icons of connectivity are blinking so i didn't gave care to troubleshoot connectivity after a period i noticed that cable is plugged into the unfunction NIC
so i decided to write a tiny script to handle the situation if someone unplugged the cable and put it and in the unfunction NIC
a college of mine said you could simply assign the other NIC with same TCP/IP settings and he is right and yes its legal to assign same TCP/IP settings to different NIC but it must be disconnected i can do it and make my life much more easier but i decided to automate the process
and write batch script using netsh and automate it as cron job that's all
Code:
(netsh interface show interface | find /i "Local Area Connection" | findstr /B "Enabled" > nul && netsh interface show interface | find /i 
"Local Area Connection" | findstr  "Connected" > nul)
&& (netsh diag ping adapter 1 | find  /I "Reply"  
&& IF %ERRORLEVEL% == 0 echo extra check was successful ) 
|| (echo going to assign TCP/IP settings from a file  & netsh -f c:\location1.txt && echo all is done)

sorry for long
# 2  
Old 02-06-2009
um. this is a unix forum. dont you think it might be better to ask windows people about this issue?
# 3  
Old 02-07-2009
Quote:
Originally Posted by fimblo
um. this is a unix forum. dont you think it might be better to ask windows people about this issue?
Thank for response
but its not an issue it's just a tip for automating ip settings and posted it here because the forum is related to networking in general.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need an automated script

Hi, I need a script to execute below task. As of now I am doing it manually and want it automated. 1)go to below path cd /path/of/file check for the availibility of two file as below of the latest date. test.week1.data test.week2.data Case1. If above files are not present... (3 Replies)
Discussion started by: sv0081493
3 Replies

2. Solaris

Unplug power from Sparc Server T5440 when in OpenBoot

show /HOST command shows that status = OpenBoot Running when in this state, can the power be unplugged from the server ? we are unable to bring the status to "powered off". Even if we issue "stop /SYS" it will momentarily be in the powered off status and then go back to power on... (1 Reply)
Discussion started by: paulk93
1 Replies

3. UNIX for Dummies Questions & Answers

how to make script automated

if i have a script called test.sh file1=$(ls -l|awk '{print $9 $1}') awk ' /date_of_selling:/ { print $6 ":" &9 }' /$file1 >> data.txt if i wanna this script to run automatically every day at 8 am :D (3 Replies)
Discussion started by: teefa
3 Replies

4. UNIX for Advanced & Expert Users

TCP Kernel Settings

I have solaris 9 system. I want to change the "tcp_conn_req_max_q" setting in /etc/system. whats the correct way, set ndd:tcp_conn_req_max_q=2048 or set tcp:tcp_conn_req_max_q=2048 thanks (1 Reply)
Discussion started by: chaandana
1 Replies

5. Shell Programming and Scripting

Automated log script

Hello, I am scripting noob but I need little monitoring script. It will be very good if you can help me. What I need: Script will login via ssh to another machine (ssh -l user ipadress), make top command and log first row + machine ip. It should monitor like 10 machines. Script should run... (1 Reply)
Discussion started by: Biosko
1 Replies

6. Red Hat

[RHEL4.5] server shutdown when I unplug the ethernet cable

hi.. I unplug my eth0 lan cable.. and suddenly my system shutdown... no idea :eek::confused: (3 Replies)
Discussion started by: flekzout
3 Replies

7. Shell Programming and Scripting

i want automated script

echo "Enter your choice :\c" read num case $num in . 1)"${TEST_HOME}"/ctrl_extract.ksh 1 ;; 2)"${TEST_HOME}"/ctrl_extract.ksh 2 ;;3)"${TEST_HOME}"/ctrl_extract.ksh 3 ;; 4)"${TEST_HOME}"/ctrl_extract.ksh 4 ;; 5)"${TEST_HOME}"/ctrl_extract.ksh 5 ;;... (3 Replies)
Discussion started by: arghya_owen
3 Replies

8. Shell Programming and Scripting

Need automated shell script please

I'm totally new to shell scripting and I would like to ask your help 1.i want to have a .sh script where it runs opening 2 applications one after another 2.i have 2 applications in /applications/app1 /applications/app2 3. want this script to launch app1 for 20 seconds and get killed... (2 Replies)
Discussion started by: uneex
2 Replies

9. UNIX for Advanced & Expert Users

help for automated script

Hi ALL: I need to write a script that will start bunch of servers. and these servers each has a sudo account and they need a passowrd. I dont know where to start and look. Can you please give me some hints or some sample code. Thanks in advance. splax (4 Replies)
Discussion started by: splax
4 Replies
Login or Register to Ask a Question