use Win32::Service; $ServiceName = "SomeService"; sub StartRCS { print "Attempting to start Radia Configuration Server\n"; my %ServiceHash = (); Win32::Service::GetStatus('', $ServiceName, \%ServiceHash); if (%ServiceHash) { if ($ServiceHash{CurrentState} != Win32::Service->SERVICE_RUNNING) { if (Win32::Service::StartService('', $ServiceName)) { print "RCS Service start command completed successfully"; } else { print "RCS could not be started"; } } else { print "RCS Service already appears to be running"; } } else { print "'$ServiceName' service doesn't exist"; } }