RSS

Scripting Network configurations

05 Nov

I have the most difficult task of writing a script that will perform some post-setup configuration on Windows server that should do the following:

  1. Team required NICs and set the speed/duplex accordingly
  2. Set the IP configuration information for the NIC (teamed) on pubic LAN
  3. Set all NICs to “show icon in notification area”
  4. Disable NICs that are not in use
  5. Rename all NICs to based on our standard
  6. Unbind specific NICs from network protocols and services if not needed
  7. Set the binding order of the NICs

So far the results are pretty good, I have managed to get 1, 2, 4 and 5 completed. 3 is easy, just a bit more coding that I wanted. 6 and 7 are proofing to be an impossible task if you are not a C++ or VBS programmer.

The problem with admin scripting of Windows network is that there is no one consistent interface or provider in which you can perform the various actions. You may need to visit the network via WMI, the registry, explorer|control panel, netsh, vendor specific CLIs and even DDK programming, if you need to achieve all of the tasks above.

Anyway, I will post my scripts here as I get each components completed

Update

I know there have been requests for the script. I had it using in my company to deploy severs over 2 years so I can say that it stable. However, my initial thought about sharing the code here is that its pretty monolithic, i.e ugly (because there was some time constraint in creating the script) and am somewhat embarrassed to post it in public in a place where so many programming and software engineering guru exists.

But again, I don’t know of anyone posting any equivalent type of script to share and as a person who believes strongly in sharing technical knowledge (amongst other things), I have decided bite the bullet to post the script here. Hopefully, it will help your productivity in your own work in time to come.

Please let me know what you don’t understand about the script and I will explain it to you. Ap0logise for the bad programming practise in the codes.

A bit about the logic of the script and only for HP servers:

  • Port 1 (embedded) teamed with port 1 of the first external NIC slot
  • Teamed NIC is set to FailOnFault as default
  • Port2 (embedded) is used for backup (TSM) at default to 100/full – Optional
  • Port 2 of the external NIC slot is used of cluster heartbeat annd default to 10/full – Only for clusters
  • All NICs unused are disabled

Here is the main scripts: SetNicConfig.wsf

Here is the function library: FuncUtils.vbs

Advertisements
 
7 Comments

Posted by on November 5, 2010 in Scripts, VBScripts, Windows

 

7 responses to “Scripting Network configurations

  1. Jeremy

    September 10, 2007 at 11:53 am

    Hey buddy,

    Have you had any luck with the part of the script that changes the binding order. Trying to write one myself, but can’t quite find the right method.

    Cheers,
    Jeremy.

     
  2. saltwetfish

    September 10, 2007 at 2:27 pm

    Sorry Jeremy, no such luck. This function is deep within in network driver functions and we need someone who knows DDK network api enough to write a wrapper to set the binding order

     
  3. rkkalady

    November 15, 2009 at 5:58 pm

    Hi Buddy

    Not sure whether you are still in there… 🙂

    But could you please mail me the components… 1, 2, 4 and 5

    1. Team required NICs and set the speed/duplex accordingly
    2. Set the IP configuration information for the NIC (teamed) on pubic LAN
    4. Disable NICs that are not in use
    5. Rename all NICs to based on our standard

    I’d be really grateful for the same. Thanks in advance

    Regards
    Ramakrishnan M

     
    • saltwetfish

      December 18, 2009 at 8:09 am

      Hi Ramakrishnan,

      will try to find time to clean up my codes and send them to you

       
    • Karxx

      September 21, 2010 at 7:28 pm

      Hi Buddy,

      keep interested by:

      1. Team required NICs and set the speed/duplex accordingly
      2. Set the IP configuration information for the NIC (teamed) on pubic LAN
      4. Disable NICs that are not in use

      please could you mail me.

      Thanks very much

       
  4. IanT

    April 16, 2010 at 3:43 pm

    Good morning, I was wondering if you had any luck with finding a way to script or programmatically set the NIC binding order from within Windows XP Professional SP3 or Windows 2003 Server SP1. I found nvpsbind.exe, however it only changes the NIC binding order in a specific protocol. So far, I haven’t been able to get it to work as I had hoped. Thank you.

     
    • saltwetfish

      April 17, 2010 at 3:14 pm

      The only way to do low level network configuration is really via device programming, which is what nvpsbind does. It wraps the low level stuff to allow us to configure the protocols and bidning order.

      I am not sure what you want to do that nvpsbind cannot do, any further details?

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: