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

23 lines
414 B
Perl

#!/usr/bin/perl -w
use Win32::NetAdmin;
$status = Win32::NetAdmin::GetServers( '', '',
SV_TYPE_ALL,
\%all_systems );
if ($status) {
@keys = keys( %all_systems );
@sorted = sort( @keys );
foreach $key (@sorted) {
print "$key $all_systems{$key}\n";
}
} else {
print_error();
}
sub print_error {
print Win32::FormatMessage( Win32::GetLastError() );
}