#!/usr/bin/perl use strict; use warnings; use Data::Dumper; local $Data::Dumper::Purity = 1; local $Data::Dumper::Useqq = 1; local $Data::Dumper::Deparse = 1; local $Data::Dumper::Sortkeys = sub { my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; }; $! = (); $@ = ''; require Win32::Service; print "Version: ".Win32::Service->VERSION."\n"; Win32::Service::StartService('','Apache2.4') or do { print "Fehler '".(defined $! ? $! : '-undef-')."' / '" .(defined $@ ? $@ : '-undef-')."'\n"; }; sleep 1; # sonst ist der Status "StartPending" my %sttus; if (Win32::Service::GetStatus('','Apache2.4',\%sttus)) { print "Status:\n".Dumper(\%sttus)."\n"; } else { print "Status nicht abfragbar\n"; }