#!/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
    see Win32::Service for APIs in the same ballpark that may be of service (TIMTOWTDI)
      Nope .. Win32::Service only provides Current running status for the service. It does NOT provide the "Startup Type" info.

      There probably is MTOWTDI, but the registry is standard, and lightweight and reveals intentions clearly, so why bother.