#!/usr/bin/perl use strict; sub StartServ { $computername = ''; $servicename = 'ProtectedStorage'; Win32::Service::GetStatus("\\\\".$computername, $servicename, \%status); die "service is arealdy started\n" if ($status{CurrentState} == 4); Win32::Service::StartService("\\\\".$computername,$servicename) || die "Can't start service\n"; print "Service started\n"; }