#FILTER_NORMAL_ACCOUNT Lists normal accounts on a system. #FILTER_SERVER_TRUST_ACCOUNT Lists domain controller account data on a domain controller. #FILTER_INTERDOMAIN_TRUST_ACCOUNT Lists domain trust accounts on a domain controller. #FILTER_TEMP_DUPLICATE_ACCOUNTS Lists local accounts on a domain controller. #FILTER_WORKSTATION_TRUST_ACCOUNT Lists workstation accounts on a domain controller. #!/usr/bin/perl -w use Win32::NetAdmin; $host = ''; $status = Win32::NetAdmin::GetUsers($host, FILTER_NORMAL_ACCOUNT, \%users); if ($status) { print_hash( \%users ); } else { print_error(); } sub print_hash { my($hash_ref) = $_[0]; my(@keys) = keys( %$hash_ref ); my($key); my(@sorted) = sort( @keys ); foreach $key (@sorted) { print "\t $key $$hash_ref{$key}\n"; } } sub print_error { print Win32::FormatMessage( Win32::GetLastError() ); }