#!/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() );
}