#!/usr/bin/perl die "Usage: $0 service_name\n" unless @ARGV == 1; use strict; use warnings; use Win32::TieRegistry( Delimiter=>"/" ); my $service = $ARGV[0]; my %start = ( '0x00000002' => 'an automatic', '0x00000003' => 'a manual', '0x00000004' => 'a disabled', ); my $services = $Registry->{'HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSe +t/Services/'}->{$service} or die "Unknown service: $service\n"; my $servstart = $services->GetValue('Start'); print "$service is $start{$servstart} service.\n";
Update: added limited error checking.
C:\>servicetype.pl Alerter Alerter is an automatic service. C:\>servicetype.pl foo Unknown service: foo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Check Win32 Service Start Type
by welchavw (Pilgrim) on Aug 14, 2003 at 04:35 UTC | |
by NetWallah (Canon) on Nov 26, 2003 at 02:00 UTC |