How do I get information such as the computer BIOS serial number, manufacturer, version number, and name? I remember, I can use it.
WINAPI and ASM obtain BIOS hardware information, but Yes, I don't know. the as What to do, Caishuxueqian no way
then choose what I've used. Bar, using Microsoft to provide Give us the WMI interface for the BIOS is externally
Open the interface for Win32_BIOS is an effect after the code is run,
Msdn:win32_bios class
The Win32_BIOS WMI class represents the attributes of the computer system ' s basic input/output Services (BIOS) t Hat is installed on a computer.
The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties is listed in alphabetic order and not MOF order.
Syntax:
[Provider ("CIMWin32")]class win32_bios:cim_bioselement{ uint16 bioscharacteristics[]; String biosversion[]; String BuildNumber; String Caption; String codeset; String currentlanguage; String Description; Uint8 embeddedcontrollermajorversion; Uint8 embeddedcontrollerminorversion; String Identificationcode; UInt16 installablelanguages; DateTime installdate; String languageedition; String listoflanguages[]; string manufacturer; String Name; String OtherTargetOS; Boolean Primarybios; DateTime releasedate; String serialnumber; String smbiosbiosversion; UInt16 smbiosmajorversion; UInt16 smbiosminorversion; Boolean smbiospresent; String Softwareelementid; UInt16 softwareelementstate; String Status; Uint8 systembiosmajorversion; Uint8 systembiosminorversion; UInt16 TargetOperatingSystem; String Version;};
Many of the properties associated with BIOS are listed above, please refer to MSDN,
Sub Main () Dim objWMIService = GetObject ("winmgmts:\\.\root\cimv2") Dim objbioscollection = Objwmiservic E.execquery ("SELECT * from Win32_BIOS") If (objbioscollection.count <= 0) then Console.WriteLine ("Your Power The brain does not have a BIOS, so how do you boot it? ") Else Console.WriteLine (" Your computer has a BIOS: ") Dim nnoofbioshardware as Integer = vbnull For each objbioshardware in objbioscollection Dim strbioshardwareinfo = "ordinal:" & Nnoofbioshardware &A mp vbNewLine strbioshardwareinfo &= "Name:" & Getnameofbioshardware (objbioshardware) & vbNewLine Strbioshardwareinfo &= "Manufacturer:" & Getmanufacturerofbioshardware (objbioshardware) & vbNewLine Strbioshardwareinfo &= "Serial number:" & Getserialnumberofbioshardware (objbioshardware) & vbNewLine Strbioshardwareinfo &= "version number:" & Getversionofbioshardware (objbioshardware) & vbNewLine C ONsole. WriteLine (Strbioshardwareinfo) Next Console.readkey (False) End If End Sub
The above code I do in order not to use. NET wrapper after the WMI object class using VB is late binding characteristics
Call the GetObject function directly to create the WMI service when you create the WMI service through a WQL query
Dynamically bound path strings have some requirements for details see: Constructing a moniker string
The moniker string format is similar to, a standard WMI object path. For more information, see WMI Object Path Requirements.
A moniker has the following parts:
- The prefix winmgmts: (mandatory)
- A Security Settings component (optional)
- A WMI Object Path component (optional)
You cannot specify a password in a WMI moniker string. If You must change the password (strpassword parameter) or the type of authentication (strauthority para meter) when connecting-to-WMI, then-call swbemlocator.connectserver. Be aware this can only specify the password and authority in connections to remote computers. Attempting to set these in a script, that's running on the local computer results in a error.
The following moniker specifies the swbemservices object that represents the namespace root\default, with IMPers Onation on and the Wbemprivilegedebug (SeDebugPrivilege) privilege enabled, and the Wbemprivilegesecurity (Sesecuritypriv Ilege) privilege disabled.
"Winmgmts:{impersonationlevel=impersonate," _ & "(debug,!security)}!root\default"
Take the BIOS serial number
Function Getserialnumberofbioshardware (ByVal objbioshardware) as String If (Marshal.iscomobject (objbioshardware ) and return Objbioshardware.serialnumber Else return nothing end If End Function
Take the BIOS manufacturer
Function Getmanufacturerofbioshardware (ByVal objbioshardware) as String If (Marshal.iscomobject (objbioshardware ) and return objbioshardware.manufacturer Else return nothing end If End Function
To take the BIOS version number
Function Getversionofbioshardware (ByVal objbioshardware) as String If (Marshal.iscomobject (Objbioshardware)) Then return objbioshardware.version Else return to Nothing end If End Function
Take the BIOS name
Function Getnameofbioshardware (ByVal objbioshardware) as String If (Marshal.iscomobject (objbioshardware)) Then Return Objbioshardware.name Else Return Nothing end If End Function
The code above doesn't seem to make much sense, there is only one meaning.
When we do software licensing, we may need a valid serial number of CPU, BIOS, disk
Do not pull, need code can go to http://pan.baidu.com/s/1hqB3zSw Baidu Network disk download
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
vb.net Access BIOS Information