How to Use WMI to Update BIOS
BIOS is Microsoft Windows software that helps begin the computer start-up process. It contains basic code that checks that all systems are functional and then loads them in such an order as to not overwhelm the system. To ensure your computer starts correctly, it is a good idea to update your BIOS software periodically. You can do so using Windows Management Instrumentation (WMI) code.
Instructions
-
-
1
Open Wordpad. This text processor will create a blank document.
-
2
Copy and paste the following into the document. Be sure not to add any extra spaces. This WMI code first loads the current BIOS information, then runs the upgrade:
strComputer ="."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMI.ExecQuery("SELECT * FROM Win32_BIOS")
For Each itm In colItems
strBIOSVersion = Join(itm.BIOSVersion, ",")
WScript.Echo "BIOSVersion: " & strBIOSVersion
WScript.Echo "BuildNumber: " & itm.BuildNumber
WScript.Echo "SMBIOSBIOSVersion: " & itm.SMBIOSBIOSVersion
WScript.Echo "SMBIOSMajorVersion: " & itm.SMBIOSMajorVersion
WScript.Echo "SMBIOSMinorVersion: " & itm.SMBIOSMinorVersion
WScript.Echo "Version: " & itm.Version
Next
const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\NewKey"
strComputer = "."
iValues = Array(&H01,&Ha2,&H10)
Set oReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SOFTWARE\NewKey"
BinaryValueName = "Example Binary Value"
oReg.SetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_
BinaryValueName,iValues
-
-
3
Save the file as "XXXX.vbs." What you name it (the "XXXX") does not matter; just be sure to add the vbs extension.
-
4
Select "No" if Wordpad pops up a message asking to add the "txt" extension.
-
5
Quit Wordpad.
-
6
Click your computer's Start menu.
-
7
Type "cmd.exe" (no quotes) into the search bar.
-
8
Click "cmd.exe."
-
9
Type "cscript XXXX.vbs" (no quotes) into the window that appears. Replace "XXXX" with whatever you named the file in Step 3. This will run the update and restart your computer.
-
1
References
- Photo Credit Computer image by Haris Rauf from Fotolia.com