API's for BIOS Settings

  • Thread starter Thread starter Lance McGonigal
  • Start date Start date
L

Lance McGonigal

Thanks in advance for your help.

Does anyone know how to get a pc's BIOS settings?

Thanks
 
Lance McGonigal said:
Does anyone know how to get a pc's BIOS settings?

Which settings in particular? There are various "GetSystem..." API
functions available, such as GetSystemInfo and GetSystemMetrics, as
well as EnumDisplaySettings. Whether the settings you're interested in
are available through these or other functions, I can't say.
 
I'm looking for something that shows which drives are enabled, boot options,
drive settings, etc.

Thanks again for your help.
 
Lance McGonigal said:
I'm looking for something that shows which drives are enabled, boot
options, drive settings, etc.

To list all drives, see the code here:

http://www.mvps.org/access/api/api0003.htm
API: Enumerating Local and Network Drives

You can find out which is the boot drive by calling the
GetSystemDirectory API function, like this:

'----- start of code -----
Private Declare Function GetSystemDirectory Lib "kernel32" _
Alias "GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long

Function BootDriveLetter() As String

Dim sSave As String, Ret As Long

sSave = Space(255)
'Get the system directory
Ret = GetSystemDirectory(sSave, 255)

BootDriveLetter = Left(sSave, 1)

End Function
'----- end of code ----

Then there's additional volume information you can get using techniques
shown here:

http://www.vb-helper.com/howto_detailed_drive_information.html

and here:

http://www.vb-helper.com/howto_smart_drive_information.html

That should get you started, and a Google search should take you the
rest of the way.
 
Thanks in advance for your help.

Does anyone know how to get a pc's BIOS settings?

Thanks

Hi Lance,

Do you have to use VBA? The reason I ask is because Windows scripting works
really well for this.

I recently had to do some automated inventory work on our computers. Below is a
script that gets you BIOS info. All I needed was the serial number but there
are plenty of other things available.

Hope it helps!

RD

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
Next
 
RD said:
Hi Lance,

Do you have to use VBA? The reason I ask is because Windows scripting
works
really well for this.

I recently had to do some automated inventory work on our computers. Below
is a
script that gets you BIOS info. All I needed was the serial number but
there
are plenty of other things available.

Hope it helps!

RD

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
Next

FWIW, it's pretty trivial to rewrite that script to work in VBA

Dim strComputer As String
Dim objWMIService As Object
Dim colSMBIOS As Object
Dim objSMBIOS As Object

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Debug.Print "Serial Number: " & objSMBIOS.SerialNumber
Next
 
Back
Top