# Gets a list of users from the PDC and prints them to accounts.txt # This is used in conjunction with orphan.pl to find orphaned home directories. use strict; use Win32::NetAdmin qw(GetUsers UserGetAttributes); my (@accounts,$x,$homeDir,$account); my $PDC='yourPDC'; my $filter='FILTER_NORMAL_ACCOUNT'; my $out='accounts.txt'; # Slurp all accounts into @accounts... GetUsers($PDC,$filter, \@accounts) or die "Can't get users $!"; print "got accounts\n"; open OUT,">$out"; foreach $account(@accounts){ UserGetAttributes($PDC,$account,$x,$x,$x,$homeDir,$x,$x,$x) or warn "UserGetAttributes() failed: $^E"; $homeDir=lc ($homeDir); print OUT "$account\t$homeDir\n"; } close OUT;