Get Servers : NetAdmin « Win32 « Perl






Get Servers

  

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

   
    
  








Related examples in the same category

1.Create a new user account
2.Listing all users
3.Prints Windows Primary Domain Controller