Adding Windows 10 Version, BIOS Mode and Secure Boot State to BGInfo

Recently, my team has been doing a lot of testing for our next big Windows 10 In-place Upgrade. We are designing and developing a new process that I call Windows as a Service in the Enterprise (and we plan on sharing this at MMSMOA in May). As part of our testing, we need to test both physical systems and virtual, both legacy BIOS and UEFI. Since the days seem to run together, often times I find myself wondering not only what system I am looking at, but what OS it is currently running and how it is configured. Sure this is easy to find from System Information, but typing msinfo32 gets old. Having used BGInfo in the past, I thought this would be a perfect solution to just display this information on the desktop.

I took the time one weekend to figure out how I could use BGInfo to display the friendly version of Windows 10 – the YYMM one, not the OS build (I can barely remember my phone number these days let alone a bunch of Windows 10 build numbers – see sKatteRbrainZ‘s blog My First Day as Microsoft CEO for a funny laugh about Windows 10 versions, names and other things that don’t make sense). Also, being called the ‘UEFI guy’ at times, I wanted to display if a system was running legacy BIOS (bad) or UEFI (good) and if Secure Boot was On (good) or Off (bad).

First things first, you want to be sure that you download the latest version of BGInfo that works with Windows 10 (at the time of this writing, the latest version is 4.25). Running BGInfo, we see that there are a few built in fields that we can use (but not what we are looking to add) and also a Custom button:

Looking at the possibilities, we see the options to select Environment variable, Registry, WMI Query, Version information for a file, Time stamp of a file, Contents of a file, or VB Script file (wait – no PowerShell option?? Quick, some tell Mark Russinovich to update this thing before Jeffrey Snover finds out).

The friendly version of Windows 10 is actually easy to get since it is stored in the registry value ReleaseId under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion.

Simply add a new custom user defined field and call it Version pointing to that registry value.

Next, add a field called Manufacturer and another one called Model. These are handy to have when connecting to systems remotely, you quickly know what make/model you are on. Both will be WMI queries:
SELECT Manufacturer FROM Win32_ComputerSystem
SELECT Model FROM Win32_ComputerSystem

Now it is time to add the BIOS Mode. At first I thought this was going to be another easy WMI query. Back in Configuration Manager 1702, the CM team added this information to WMI under the class SMS_Firmware (and then added Secure Boot state in 1706). This was known as the Mike Terrill feature per David James:

However, my hopes were shattered once I found out that BGInfo can only use the default namespace. So with that out and PowerShell no where to be found, I had to resort to good old VBScript. The trick was to use the Secure Boot registry key to determine both the BIOS mode and the Secure Boot state.

BIOSMode.vbs:

Const HKEY_LOCAL_MACHINE  = &H80000002
strComputer = "."
hDefKey = HKEY_LOCAL_MACHINE
strKeyPath = "SYSTEM\CurrentControlSet\Control\SecureBoot\State"
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

If oReg.EnumKey(hDefKey, strKeyPath, arrSubKeys) = 0 Then
  echo "UEFI"
Else
  echo "BIOS"
End If

 

SecureBoot.vbs:

Const HKEY_LOCAL_MACHINE = &H80000002 
strComputer = "."  
hDefKey = HKEY_LOCAL_MACHINE
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") 
strKeyPath = "SYSTEM\CurrentControlSet\Control\SecureBoot\State" 
strValueName = "UEFISecureBootEnabled" 
oReg.GetDWORDValue hDefKey,strKeyPath,strValueName,dwValue 

If dwValue = 0 Then 
	Echo "OFF"
ElseIf dwValue = 1 Then 
	Echo "ON"
Else
	Echo "NA"
End If

Place both scripts where BGInfo can access them when it is run (I use C:\Program Files\BGInfo\) and create a new custom user defined field for each (BIOS Mode and Secure Boot). Once done the User Defined Fields will look like the following:

Lastly, add, order and position the desired fields that you want to be displayed and the Apply button to test it. I have selected the following fields:

This looks like the following when run on different configurations of Windows 10:

Download BGInfo file and scripts (rename to .vbs after unzipping) here.

Hopefully you find this as useful as me when doing your Windows 10 In-place Upgrade testing. If you have other suggestions on fields you have added, tell me about them in the comments below.

Originally posted on https://miketerrill.net/

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