Not sure from what list this was received ( on a number of them ),
but here is one using Win32::Service. Change the 'xxxxxxxxx' within
GetServices for the computer you are running on or want to get at.

use Win32::Service;

#set up a hash of known service states
my %statcodeHash = (
     '1' => 'stopped.',
     '2' => 'start pending.',
     '3' => 'stop pending.',
     '4' => 'running.',
     '5' => 'continue pending.',
     '6' => 'pause pending.',
     '7' => 'paused.'
);

my ($key, $services, %statusHash, $ID, %serviceHash);

$ID = 0;
Win32::Service::GetServices('xxxxxxxx',\%services);

foreach $key (sort keys %services){
        Win32::Service::GetStatus( '', $services{$key}, \%statusHash);
        print "$ID $key ($services{$key})";
        if ($statusHash{"CurrentState"} =~ /[1-7]/){
         print $services{"$key"} . " is currently " .
$statcodeHash{$statusHash {"CurrentState"}} . "\n";
        }

        $ID++;
}


Wags ;)
-----Original Message-----
From: Nigel Peck [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 05:24
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Windows NT / 2000 Services


There isn't. However, you might be able to get what you want from the
net command. At a command prompt

net services

will tell you which services can be started, from which you could
derive which ones are already started.

You might be able to get some information from the registry but I'm not
sure where. You could also view the running processes to see if the
executable for the service is running.

There may be a better way.

HTH
Nigel

>>> "Hughes, James" <[EMAIL PROTECTED]> 07/15/02 10:29am >>>
Can anyone tell me if , and where there is an ascii file that holds
the
current status of Windows NT and or 2000 services? This will help me
greatly
with a perl project. Thanks!


Jim

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to