How to Use Perl CPU Info?
This Perl script determine's information about the installed OS, computer name, processor , RAM , hard-drives, and computer network settings.
Perl WinInfo. pulls > output. txt
This will save the output of the script to a file called output.txt.
use Win32;
use Win32::SystemInfo;
use Win32::DriveInfo;
use Win32::IPConfig;
use strict;
use warnings;
print "OS Informationn";
my $computer=Win32::NodeName();
print "Computer name :$computern";
My $domain=Win32:: DomainName ();
Print "This Computer is a member of the $domain domain/workgroupn";
my $OS=Win32::GetOSDisplayName();
Print "The OS is $OSn";
my $fs=Win32::FsType();
print "The filesytem is $fsn";
my $user=Win32::LoginName();
print "Current user is $usern";
my $admin=Win32::IsAdminUser();
if($admin!=0){
   print "$user is running this script as adminnnn";
}
else{
   print "$user is not running this script as adminnnn";
}
print "Processor Information and RAM Informationn";
my %processor;
Win32::SystemInfo::ProcessorInfo(%processor);
for (my $i=0;$i<$processor{NumProcessors};$i++) {
   print "Processor$in";
   print "Processor Name: " . $processor{"Processor$i"}{ProcessorName} . "n";
   print "Processor Info: " . $processor{"Processor$i"}{Identifier} . "n";
   print "Processor Speed: " . $processor{"Processor$i"}{MHZ} . "MHznn";Â
}
my %memory;
Win32::SystemInfo::MemoryStatus(%memory, 'GB');
print "The computer has $memory{TotalPhys} GB of RAMnnn";
my %dtypes=(0 => "Undetermined",
1 => "Does Not Exist",
2 => "Removable",
3 => "Hard drive",
4 => "Network",
5 => "CDROM",
6 => "RAM Disk");
print "Drive Informationn";
my @drives = Win32::DriveInfo::DrivesInUse();
foreach my $drive (@drives){
   my $type=Win32::DriveInfo::DriveType($drive);
   print "Drive $drive is a $dtypes{$type}n";
  Â
}
print "nnNetwork Information";
my $ipconfig = Win32::IPConfig->new($computer)
        or die "Unable to connect to $computern";
foreach my $adapter ($ipconfig->get_adapters) {
   print "nAdapter '", $adapter->get_name, "':n";
   print "Description=", $adapter->get_description, "n";
   print "DHCP enabled=",
   $adapter->is_dhcp_enabled ? "Yes" : "No", "n";
   my @ipaddresses = $adapter->get_ipaddresses;
   print "IP addresses=@ipaddresses (", scalar @ipaddresses, ")n";
   my @subnet_masks = $adapter->get_subnet_masks;
   print "subnet masks=@subnet_masks (", scalar @subnet_masks, ")n";
   my @gateways = $adapter->get_gateways;
   print "gateways=@gateways (", scalar @gateways, ")n";
   print "domain=", $adapter->get_domain, "n";
   my @dns = $adapter->get_dns;
   print "dns=@dns (", scalar @dns, ")n";
   my @wins = $adapter->get_wins;
   print "wins=@wins (", scalar @wins, ")n";
}