program GetWMI_Info;
{$APPTYPE CONSOLE}
uses
SysUtils,
ActiveX,
ComObj,
Variants;
procedure GetWin32_BIOSInfo;
const
WbemUser ='';
WbemPassword ='';
WbemComputer ='localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : OLEVariant;
oEnum : IEnumvariant;
iValue : LongWord;
begin;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_BIOS','WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
while oEnum.Next(1, FWbemObject, iValue) = 0 do
begin
Writeln(Format('BiosCharacteristics %d',[Integer(FWbemObject.BiosCharacteristics)]));// Uint16
Writeln(Format('BIOSVersion %s',[String(FWbemObject.BIOSVersion)]));// String
Writeln(Format('BuildNumber %s',[String(FWbemObject.BuildNumber)]));// String
Writeln(Format('Caption %s',[String(FWbemObject.Caption)]));// String
Writeln(Format('CodeSet %s',[String(FWbemObject.CodeSet)]));// String
Writeln(Format('CurrentLanguage %s',[String(FWbemObject.CurrentLanguage)]));// String
Writeln(Format('Description %s',[String(FWbemObject.Description)]));// String
Writeln(Format('EmbeddedControllerMajorVersion %d',[Integer(FWbemObject.EmbeddedControllerMajorVersion)]));// Uint8
Writeln(Format('EmbeddedControllerMinorVersion %d',[Integer(FWbemObject.EmbeddedControllerMinorVersion)]));// Uint8
Writeln(Format('IdentificationCode %s',[String(FWbemObject.IdentificationCode)]));// String
Writeln(Format('InstallableLanguages %d',[Integer(FWbemObject.InstallableLanguages)]));// Uint16
Writeln(Format('InstallDate %s',[String(FWbemObject.InstallDate)]));// Datetime
Writeln(Format('LanguageEdition %s',[String(FWbemObject.LanguageEdition)]));// String
Writeln(Format('ListOfLanguages %s',[String(FWbemObject.ListOfLanguages)]));// String
Writeln(Format('Manufacturer %s',[String(FWbemObject.Manufacturer)]));// String
Writeln(Format('Name %s',[String(FWbemObject.Name)]));// String
Writeln(Format('OtherTargetOS %s',[String(FWbemObject.OtherTargetOS)]));// String
Writeln(Format('PrimaryBIOS %s',[String(FWbemObject.PrimaryBIOS)]));// Boolean
Writeln(Format('ReleaseDate %s',[String(FWbemObject.ReleaseDate)]));// Datetime
Writeln(Format('SerialNumber %s',[String(FWbemObject.SerialNumber)]));// String
Writeln(Format('SMBIOSBIOSVersion %s',[String(FWbemObject.SMBIOSBIOSVersion)]));// String
Writeln(Format('SMBIOSMajorVersion %d',[Integer(FWbemObject.SMBIOSMajorVersion)]));// Uint16
Writeln(Format('SMBIOSMinorVersion %d',[Integer(FWbemObject.SMBIOSMinorVersion)]));// Uint16
Writeln(Format('SMBIOSPresent %s',[String(FWbemObject.SMBIOSPresent)]));// Boolean
Writeln(Format('SoftwareElementID %s',[String(FWbemObject.SoftwareElementID)]));// String
Writeln(Format('SoftwareElementState %d',[Integer(FWbemObject.SoftwareElementState)]));// Uint16
Writeln(Format('Status %s',[String(FWbemObject.Status)]));// String
Writeln(Format('SystemBiosMajorVersion %d',[Integer(FWbemObject.SystemBiosMajorVersion)]));// Uint8
Writeln(Format('SystemBiosMinorVersion %d',[Integer(FWbemObject.SystemBiosMinorVersion)]));// Uint8
Writeln(Format('TargetOperatingSystem %d',[Integer(FWbemObject.TargetOperatingSystem)]));// Uint16
Writeln(Format('Version %s',[String(FWbemObject.Version)]));// String
Writeln('');
FWbemObject:=Unassigned;
end;
end;
begin
try
CoInitialize(nil);
try
GetWin32_BIOSInfo;
finally
CoUninitialize;
end;
except
on E:EOleException do
Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));
on E:Exception do
Writeln(E.Classname, ':', E.Message);
end;
Writeln('Press Enter to exit');
Readln;
end.
Tuesday, October 23, 2018
Related Posts
Tutorial
Post a Comment