Powered by GeSHi

Source code for bios.pl

(view source code of bios.pl as plain text)

  1. #! perl
  2.  
  3. # WMI query to list all properties and values of the Win32_BIOS class
  4. # This Perl script was generated using the WMI Code Generator, Version 1.30
  5. # http://www.robvanderwoude.com/updates/wmigen.html
  6.  
  7. use Win32::OLE( 'in' );
  8.  
  9. use constant wbemFlagReturnImmediately => 0x10;
  10. use constant wbemFlagForwardOnly       => 0x20;
  11.  
  12. if ( $ARGV[0] ) {
  13. 	$computer = $ARGV[0];
  14. } else {
  15. 	$computer = ".";
  16. }
  17.  
  18. my $objWMIService = Win32::OLE->GetObject( "winmgmts://$computer/root/CIMV2" ) or die "WMI connection failed.\n";
  19. my $colItems = $objWMIService->ExecQuery( "SELECT * FROM Win32_BIOS", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly );
  20.  
  21. foreach my $objItem ( in $colItems ) {
  22. 	print "Name                           : " . $objItem->{ Name } . "\n";
  23. 	print "Version                        : " . $objItem->{ Version } . "\n";
  24. 	print "Manufacturer                   : " . $objItem->{ Manufacturer } . "\n";
  25. 	print "SMBIOSBIOS Version             : " . $objItem->{ SMBIOSBIOSVersion } . "\n";
  26. 	print "\n";
  27. }
  28.