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:
- Team required NICs and set the speed/duplex accordingly
- Set the IP configuration information for the NIC (teamed) on pubic LAN
- Set all NICs to “show icon in notification area”
- Disable NICs that are not in use
- Rename all NICs to based on our standard
- Unbind specific NICs from network protocols and services if not needed
- 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
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