programming-examples/perl/Win32/Stopping services.pl
2019-11-15 12:59:38 +01:00

21 lines
412 B
Perl

# $status = Win32::Service::StopService($host, $service);
#!/usr/bin/perl -w
use Win32::Service;
$host = 'yourhost';
$service = $ARGV[0];
print "Starting $service on $host.\n";
$status = Win32::Service::StopService($host, $service);
if ($status) {
print "Started $service.\n";
} else {
print_error();
}
sub print_error {
print Win32::FormatMessage( Win32::GetLastError() );
}