BGinfo is the best tool to display computer information on the desktop wallpaper but customizing it for the actual need is pretty hard unless you know the windows functions in deep level. BGInfo has custom keys defined for common use but sometimes we will need to dig some deeper for a fine tuned result.

We will be looking at how to display the IP Address from the active network adaptors because sometime we may have virtual network adaptors on clients. (If you have Cisco VPN clients you will have such adaptors) In such instances you will see some network card information on the BGInfo without IP Address. It will look odd on your desktop wallpaper!

This will happen if we use the default IP Address field on the BGInfo. So Instead of that we will be creating a custom IP Address field which will only display the IP Address from currently active on the computer.

If you follow the below method you can create a custom field for it.

1) Open the BGInfo and Click on the Custom Button.

bginfo_1

2) Then Click on New. It will pop up the box for defining a custom field.

bginfo_2

3) Now set the Identifier name something like below and Select WMI Query. After that copy the below command and paste in the Path field. Then click OK

SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True

4) Once the custom field is applied you will see the custom field is displaying on the BGInfo main window. That’s it you can now add that field and create new customization file.

bginfo_3

This customization is most widely required in BGInfo usage. You can explore more such custom fields if you click on the Browse button in the Custom field creation Window.

37 Responses

      1. I think by “cut it” he meant that the result shows the IP address followed by the MAC address, and he wonders how to truncate the result so that the MAC address is not shown; I.e., how can one display only the IP address?

    1. hi,

      the second part that shows is the IPv6 Address..

      this .vbs script shows only the IPv4 address

      strComputer = “.”
      On Error Resume Next
      Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
      Set IPSettings = objWMIService.ExecQuery (“SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled = ‘True'”)

      For Each objIPv4 in IPSettings
      For i=LBound(objIPv4.IPAddress) to UBound(objIPv4.IPAddress)
      If InStr(objIPv4.IPAddress(i),”:”) = 0 Then Echo objIPv4.IPAddress(i)
      NEXT
      NEXT

      1. Awesome solution. Thank you so much for this.
        Finally the IPv6 address is hidden.

        One thing to note to anyone that cannot get this .vbs script to work is that you’ll need to give it some TLC after pasting in to Notepad as all the ” get replaced incorrectly when copy and pasting from here.

        Then simply save it as whatever you want in the same folder where you have Bginfo.exe/Bginfo64.exe – mine is called: Show IPv4 Address.vbs

        Then within BGInfo do the following:
        1. click the Custom button.
        2. Type IPv4 Address in the Identifier field.
        3. Select VB Script file under Replace identifier with section.
        4. In the Path field click browse and navigate to the Show IPv4 Address.vbs you saved earlier.
        5. Click OK, OK.
        6. Doubleclick IPv4 Address from the Fields list on the right had side to add it.
        7. Click Apply to test.
        8. Finally, if everything looks to be working correctly then select File > Save As… to save your config.bgi file.

      2. The reason no one acknowledged this script is because:

        1. It doesn’t work as written
        2. on error resume next = broken script does nothing

        fixed:

        ‘On Error Resume Next
        strComputer = “.”
        Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
        Set IPSettings = objWMIService.ExecQuery (“SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled = ‘True'”)
        For Each objIPv4 in IPSettings
        For i=LBound(objIPv4.IPAddress) to UBound(objIPv4.IPAddress)
        If InStr(objIPv4.IPAddress(i),”:”) = 0 Then wscript.echo objIPv4.IPAddress(i)
        NEXT
        NEXT

  1. Thank you for the WMI Query, works great, But, still shows the “0 b/s” for the wireless NIC that is not currently enabled on my system. Is there a way to remove the ‘0 b/s’ ?

    1. Hi Stephen, Did you perform a computer restart after disabling the Wifi? If you have configured the BGinfo to run on system startup it will give you only the active adaptor’s details. If that is not the case post a screenshot?

  2. Hi,
    I done the same configuration and it works for IP,but subnetmask is coming including none also.
    what has to be done for subnetmask

  3. Thanks SOOOO much for posting this – is there a way to do this for the default gateway and the dns ?

    1. Sorry found DNS and gateway
      SELECT DefaultIPGateway FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True
      SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True

      What I’m now looking for is a way to only show the active network card and their speed next to each other.

      1. LOL – sorry – I think I’ve gone as far as I can – I got the active cards listed but what I want is the active card and the active cards speed right next to each other. I got just the active cards but can’t get the speed listed next to it.
        SELECT NetConnectionID FROM Win32_NetworkAdapter WHERE NetConnectionStatus = 2 (even this is not correct – it shows me active cards – I think I’d like to show cards that have IP addresses.

        If I use the generic speed field already as a choice – it shows 4 Gb/s instead of 10Gb/s and it only lists those for all cards below the other info – I want it next to the card so I know which his which.

  4. Super bummed that I am unable to find a way to parse out the IPv6 info that comes after the IP address. I’ve tried many things and found ways to do it in PowerShell but none in the BGInfo query selection screen. Having that info will only confuse our users when reading their IP and not sure if turning IPv6 off company-wide is a solution right now.

  5. Hi there,I check your new stuff named “How to Set BGInfo to Display Only The Active Network Card’s IP Address | Renjith Menon” daily.Your humoristic style is awesome, keep doing what you’re doing! And you can look our website about proxy list.

  6. This is very helpful. Is there a way to show the network card name and the ip and the connection speed – line by line
    e.g.
    Host Nic – 10.10.89.10 1gb/s
    Virtual Switch – 10.10.89.20 10gb/s

    1. Network card should give an output if you add “Network Card” switch the same way you have added others.

      I am not certain about what you meant by the Virtual switch? Can you be more specific?

  7. For those of you who want to display IP address only…

    create a vbs file, and in “custom”, link to it

    use this as a general template

    ===cut==

    strComputer = “.”
    On Error Resume Next
    Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
    Set IPSettings = objWMIService.ExecQuery (“SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled = ‘True'”)

    For Each objIPv4 in IPSettings
    For i=LBound(objIPv4.IPAddress) to UBound(objIPv4.IPAddress)
    If InStr(objIPv4.IPAddress(i),”:”) = 0 Then Echo objIPv4.IPAddress(i)
    NEXT
    NEXT

    1. Quotation marks and comment marks must be changed to standard (“) not open/close (“/”) if you are going to copy/paste the above code…

      For Gateway, DHCP, and DNS replace each instance of:
      objIPv4.IPAddress
      with:
      objIPv4.DefaultIPGateway
      objIPv4.DHCPServer
      objIPv4.DNSServerSearchOrder
      respectively

  8. Thank you for all this information does anyone know how to also get only the “active” connections for the fields of Subnet Mask, DHCP Server, and DNS Servers?

  9. HI,

    Someone find how we can remove the MAc address displays with IP? how can one display only the IP address? With BGinfo

  10. On the back of everyone’s research so far and my own adaptions here is how I got active network card IP address (without IPv6), Subnet, DNS, Mac Address, and Speed (speed is in bytes, if someone could explain ho to get it in GB format it would be great.

    For Active Mac Address use the WMI method with this line:
    SELECT MACAddress FROM Win32_NetworkAdapter Where netconnectionstatus=2

    For Network Speed use the WMI method with this line:
    SELECT Speed FROM Win32_NetworkAdapter Where netconnectionstatus=2

    For Active IP via vbs (ty Martin Merriman) NB commas and inverted commas have to be in standard form;

    ===cut====
    strComputer = “.”
    On Error Resume Next
    Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
    Set IPSettings = objWMIService.ExecQuery (“SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled = ‘True'”)

    For Each objIPv4 in IPSettings
    For i=LBound(objIPv4.IPAddress) to UBound(objIPv4.IPAddress)
    If InStr(objIPv4.IPAddress(i),”:”) = 0 Then Echo objIPv4.IPAddress(i)
    NEXT
    NEXT
    ===cut===

    Save this into a .vbs file and in BG info select custom > new > identifier > vb script file > browse to .vbs file > ok. Then add as a new variable.

    For Gateway, DHCP, and DNS replace each instance of: (ty Brian Griswold)
    objIPv4.IPAddress
    with:
    objIPv4.DefaultIPGateway
    objIPv4.DHCPServer
    objIPv4.DNSServerSearchOrder

    For Subnet :
    objIPv4.IPSubnet

    Save a separate .vbs file and set the new variable by pointing to the new file.

    I would like to know how to format the speed correctly. I feel like vbs could do it as you can do simple math with it.
    e.g. If InStr(objIPv4.Speed(i),”:”) = 0 Then Echo objIPv4.Speed(i)/1000000 & “Mb/s” but I cannot figure it out.

    1. Hi,
      is there a way to get the IP-Adress, Subnetmask, Gateway and DNS Server from a specific network adapter (name e.g. “LAN”) even if this adapter is not connected?

      With the query “SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True” I’ll only receive these information if the adapter is connected…

      Thanks,
      Chris

    2. Short addition: I would like to display the IP address etc. that was entered in the settings of the specific adapter.

  11. very sad, this blog discussion does not support code syntax. Commas and inverted commas in the code snippets are very annoying. In my copy and pasted vbs I think I got all, but it breaks for the very first loop run with a null pointer exception in objIPv4.
    I will stop seeing this discussion as useful and try another approach.

Leave a Reply to boe Cancel reply

Your email address will not be published. Required fields are marked *