Your script does stop the service. However, you only do Win32::Service::GetStatus("", $svc, \%statusHash); once before you try to stop the service and then after you stop the service you don't ask for the status again. So actually you need something like this.
I have to wait at least 3 seconds before I can check the current status of the service before I can see that the status has changed. -----... Win32::Service::GetStatus("", $svc, \%statusHash); #if ($statusHash{"CurrentState"} =~ /4/){ print "$svc" . " is currently " . $statcodeHash{$statusHash{"CurrentSt +ate"}} . "\n"; #} if (Win32::Service::StopService('', $svc)) { sleep (3); Win32::Service::GetStatus("", $svc, \%statusHash); print "$svc" . " is currently " . $statcodeHash{$statusHash{"Curre +ntState"}} . "\n"; } else { print "Error ... $^E\n"; }
In reply to Re: Help with Win32::Service
by AcidHawk
in thread Help with Win32::Service
by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |