Wednesday, June 16, 2010

Setting Broadcom NICs to 100/FULL during an OSD Task Sequence

In our environment we require all our workstation NICs to be set to 100/FULL. Currently this is a manual step at the time of deployment and from time to time it can be missed. As I was migrating all of our images to Config Manager my goal was to automate as much as possible - such as NIC speed and duplex. Hard coding a NIC for a Windows PE boot image is pretty straight forward – extract the driver, open up the INF file, locate the section were the default speed is listed, set it to whatever value you require and then inject the driver into your boot image. However if you use the same approach when installing drivers during an OS deployment task sequence and you are using a Broadcom NIC your NIC driver will fail to load correctly causing the task sequence to error out. Once you edit the INF file you break WHQL driver signing therefore Windows XP will not install the driver. A quick way around this is to leave the INF file untouched and set it 100/FULL by calling the following script during your task sequence.

Dim WSHShell, RegLocate, RegLocate1
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next

'Locate registry setting for media type
RegLocate = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001\RequestedMediaType"

'Change media type to 100/Full Duplex
WSHShell.RegWrite RegLocate,"6","REG_SZ"

'Exit
WScript.Quit 
  1. Create a package in Config Mgr containing your script - no program necessary
  2. In your task sequence add a command line step after your driver installs
  3. Name this step something like "Set Broadcom NIC to 100/FULL" (helps for future reference) 
  4. Add the following command line - cscript.exe script name.vbs
  5. Enable the package check box and browse for the package containing your script
Add a condition to this step and enter the following WMI query to ensure that your script only runs on Broadcom based NICs.

SELECT * FROM Win32_NetworkAdapter WHERE Manufacturer LIKE 'Broadcom%'