Remove unused NICs from BGInfo

Like many organisations we use BGInfo on all Windows systems to provide a simple way to view the machine name, IP address etc.

One thing we have noticed is on laptops which have standard wireless, Bluetooth, SSL VPN etc there are a number of devices that do not have IP addresses assigned. This isn’t a technical issue but on some screens it does look a bit of a mess (see below)

BGInfo-ALL-IP

We wanted to show only ‘live’ IP addresses and remove the blanks to neaten things up slightly. Natively I couldn’t find a simple option so ended up on google and found a number of threads showing similar results. Most of the results however also showed the IPV6 address which we don’t currently need and confuses the end user when the support team ask for their IP address.

So, show active IPs, IPv4 only. I also wanted to show the Windows 10 build as this is starting to become more and more important with the six monthly release cycle and the necessary changes required.

Active IPs

I ended up creating three .vbs scripts (IP, DNS Servers, Gateway) and linking each one to a custom field within BGInfo.

IP Address VBS:

strMsg = ""
strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'")

For Each IPConfig in IPConfigSet
  If Not IsNull(IPConfig.IPAddress) Then
    For i = LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
     If Not Instr(IPConfig.IPAddress(i),":") > 0 Then
        strMsg = strMsg & IPConfig.IPAddress(i) & vbcrlf & vbtab
      End If
    Next
  End If
Next

Echo strMsg

 

DNS Server VBS:

strMsg = ""
strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select DNSServerSearchOrder from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'")

For Each IPConfig in IPConfigSet
  If Not IsNull(IPConfig.DNSServerSearchOrder) Then
    For i = LBound(IPConfig.DNSServerSearchOrder) to UBound(IPConfig.DNSServerSearchOrder)
      If i = 0 Then
        strMsg = strMsg & IPConfig.DNSServerSearchOrder(i)
      ElseIf i > 0 Then
        strMsg = strMsg & vbcrlf & vbtab & IPConfig.DNSServerSearchOrder(i)
      End If
    Next
  End If
Next

Echo strMsg

 

Default Gateway VBS:

strMsg = ""
strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select DefaultIPGateway from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'")

For Each IPConfig in IPConfigSet
  If Not IsNull(IPConfig.DefaultIPGateway) Then
    For i = LBound(IPConfig.DefaultIPGateway) to UBound(IPConfig.DefaultIPGateway)
     If Not Instr(IPConfig.DefaultIPGateway(i),":") > 0 Then
        strMsg = strMsg & IPConfig.DefaultIPGateway(i) & vbcrlf
      End If
    Next
  End If
Next

Echo strMsg

 

We now need to add these vbs scripts into BGInfo as Custom Fields:

BGInfo-New Field

Now add to the BGInfo information as a standard field and the result removes all gaps!

BGinfo-Min-IP

Windows 10 Build

Finally we need to add the Windows 10 build number. This is much easier than above as the information is held within the registry so the BGInfo custom field can simply point to it:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseID

 

 

Advertisements

WSUS install problem – no network connection

Server 2008 R2 install of WSUS fails with

 

Windows server update services – Installation failed.
The update cannot be found. There may be a network connection issue

Error: Group Policy pointing towards a non-functioning WSUS server. Change the following setting to Disabled/Not Configured

Computer Configuration\Policies\Administrative Templates\Windows Components\Windows Updates\Allow signed updates from an intranet Microsoft update service location

GPO Java Update

‘——————————– Script Start ——————————————————–

Set oShell = CreateObject(“WScript.Shell”)

sRegKey = “HKLM\SOFTWARE\JavaSoft\Java Update\Policy”

oShell.RegWrite sRegKey & “\EnableJavaUpdate”, 00000000, “REG_DWORD”

‘——————————– Script End ——————————————————–

Server 2003 use the above logon script to edit the regkey

Server 2008/2008R2 push as reg key using GPO

Key is

[HKEY_LOCAL_MACHINE\SOFTWARE\Javasoft\Java Update\Policy]
“EnableJavaUpdate”=dword:00000000

———–

Kudos to http://sgwindowsgroup.org/blogs/panda/archive/2010/05/14/disable-java-auto-update-through-gpo.aspx