Win32_BIOS version

StewartBW 1,235 Reputation points
2025-03-12T13:13:50.4633333+00:00

Hello

I'm using this code to get the BIOS version:

Dim Search2 As New ManagementObjectSearcher(New SelectQuery("Win32_BIOS"))
    For Each Info2 As ManagementObject In Search2.Get
        If Info2("SMBIOSBIOSVersion") IsNot Nothing Then MsgBox Info2("SMBIOSBIOSVersion").ToString
    Next

On systems without SMBIOS that have SMBIOSPresent set to False, will above code raise any exception?

I mean just checking If Info2("SMBIOSBIOSVersion") IsNot Nothing is enough?

Or should also check If Info2("SMBIOSPresent") IsNot Nothing AndAlso Convert.ToBoolean(Info2("SMBIOSPresent")) = True before going to get the SMBIOS version?

Thanks for advise :)

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,801 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 87,806 Reputation points
    2025-03-12T22:37:03.1066667+00:00

    The usual way is to test first if SMBIOSPresent is true before reading SMBIOSBIOSVersion (not needed for BIOSVersion)

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.