Sandhu, Suchindra wrote:
> hello,
> 
> Is there a way to find the number of CPUs on a windows 2003 terminal
> server from command line or a perl program?
> I tried googling it, but it did not help at all.

use strict;
use Win32::OLE qw(in);

my $WMI = Win32::OLE->GetObject ('winmgmts:') or
    die "GetObject: ", Win32::OLE->LastError ();
foreach my $obj (in $WMI->InstancesOf('Win32_ComputerSystem')) {
        my $NumCPUs = $obj->{NumberOfProcessors};
        print "NumCPUs = $NumCPUs\n";
}

__END__

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to