如何使用perl脚本获取BIOS信息
#! perl
 
use Win32::OLE( 'in' );
 
use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly       => 0x20;
 
if ( $ARGV[0] ) {
	$computer = $ARGV[0];
} else {
	$computer = ".";
}
 
my $objWMIService = Win32::OLE->GetObject( "winmgmts://$computer/root/CIMV2" ) or die "WMI connection failed.\n";
my $colItems = $objWMIService->ExecQuery( "SELECT * FROM Win32_BIOS", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly );
 
foreach my $objItem ( in $colItems ) {
	print "Name                           : " . $objItem->{ Name } . "\n";
	print "Version                        : " . $objItem->{ Version } . "\n";
	print "Manufacturer                   : " . $objItem->{ Manufacturer } . "\n";
	print "SMBIOSBIOS Version             : " . $objItem->{ SMBIOSBIOSVersion } . "\n";
	print "\n";
}
日期:2020-04-11 23:04:31 来源:oir作者:oir