This can be done through WMI (Windows Management Instrumentation). It
comes installed by default on Windows 2000, XP, and 98 Second Edition.
For other OS's, you may download the WMI package from Microsoft.
You access this information through the Win32::OLE module.
Below is a snippet that should work for you:
------------------------------------------------------------------------
--
use Win32::OLE qw(in with);
$server='YOUR_COMPUTER_NAME_HERE';
my $WMIServices =Win32::OLE->GetObject(
"winmgmts:{impersonationLevel=impersonate,(security)}//$server" );
$WMI = Win32::OLE->new('WbemScripting.SWbemLocator');
$Services = $WMI->ConnectServer($server);
my $bios_set = $Services->InstancesOf("Win32_BIOS");
foreach my $bios (in($bios_set)) {
print "$bios->{'Caption'}'\n";
print "$bios->{'BuildNumber'}\n";
print "$bios->{'CurrentLanguage'}\n";
print "$bios->{'Description'}\n";
print "$bios->{'InstallDate'}\n";
print "$bios->{'Name'}\n";
print "$bios->{'Manufacturer'}\n";
print "$bios->{'PrimaryBIOS'}\n";
print "$bios->{'ReleaseDate'}\n";
print "$bios->{'SerialNumber'}\n";
print "$bios->{'SMBIOSBIOSVersion'}\n";
print "$bios->{'SMBIOSMajorVersion'}\n";
print "$bios->{'SMBIOSMinorVersion'}\n";
print "$bios->{'SMBIOSPresent'}\n";
print "$bios->{'SoftwareElementID'}\n";
print "$bios->{'Status'}\n";
print "$bios->{'Version'}\n";
}
------------------------------------------------------------------------
--
Make sure you are running as an admin account to get this info.
Further info on this can be found on the msdn site of Microsoft.
These WMI groups (ie: Win32_BIOS) are called classes. You may look them
up to see what everything means.
This will compile fine with PerlApp from the PDK of ActiveState.
Note, this information is not gauranteed to be present. It's only there
if the OS can access it, and it's available via the hardware.
Scott Campbell
Senior Software Developer
Somix Technologies
(207) 324-8805
http://www.somix.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, August 19, 2002 9:23 PM
To: [EMAIL PROTECTED]
Subject: BIOS Access
Does anyone know of anyway to access the information stored in the BIOS
from Perl? I would like to access the Serial Number and Model Type of a
machine from NT/2K/XP, _without_ using an external program. I have
looked
around but have been unable to find any module to help with this task.
There is also no registry key that contains the information I am looking
for. I have other ways I can get this information, but they all require
a
3rd party app to pull this information, and then have a perl script
parse
through this. I am trying to avoid this, and having perl installed on
the
workstation, as I would like to compile this using PDK and only want to
have one executable to manage.
Any ideas would be greatly appreciated.
Thanks.
Len.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs