http://qs321.pair.com?node_id=314617


in reply to Help with Win32::Service

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.

... 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"; }
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.

-----
Of all the things I've lost in my life, its my mind I miss the most.