Use Perl to Get List/Services Running on your NT box

Use the following Perl Script to get a list of Services running on your NT system

--------------script.pl-----------------

#!c:perbinperl.exe

use Win32::Service;

my ($key, %service, %status, $part);

Win32::Service::GetServices(' ',%services);

foreach $key (sort keys %services) {

print "Print Namet: $key, $services{$key}n";

Win32::Service::GetStatus( ' ',$services{$key};

%status);

foreach $part (keys %status) {

print "t$part : $status{$part}n" if($part eq "CurrentState");

}

}

----------------------------------------

No comments: