You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
467 B
Perl

#!/usr/bin/perl -w
use Win32::Service;
$host = '';
$status = Win32::Service::GetServices($host, \%services);
if ($status) {
print_hash( \%services );
} else {
print_error();
}
sub print_hash {
my($hash_ref) = $_[0];
@keys = keys( %$hash_ref );
@sorted = sort( @keys );
foreach $key (@sorted) {
print "$key $$hash_ref{$key}\n";
}
}
sub print_error {
print Win32::FormatMessage( Win32::GetLastError() );
}