use Win32::NetAdmin qw(GetUsers GroupIsMember UserGetAttributes UserSetAttributes); my $pdc="\\\\serveur"; my %hash; GetUsers($pdc, FILTER_NORMAL_ACCOUNT , \%hash) or die "GetUsers() failed: $^E"; foreach (keys %hash) { my ($password, $passwordAge, $privilege, $homeDir, $comment, $flags, $scriptPath); if (GroupIsMember($pdc, "Domain Users", $_)) { print "$_ ($hash{$_}) "; UserGetAttributes($pdc, $_, $password, $passwordAge, $privilege, $homeDir, $comment, $flags, $scriptPath) or die "UserGetAttributes() failed: $^E"; print "|$scriptPath|$homeDir|$comment|$flags|$privilege\n" # # Divers flags repéré : # 577 Cannot change password # 515 Disabled account + must change password at logon # 66049 Password Never expires # 66113 (66049 || 577 ) Cannot change password et Never expires # 529 Locked account # # $scriptPath = "dnx_login.bat"; # this is the new login script # UserSetAttributes($pdc, $_, $password, $passwordAge, $privilege, # $homeDir, $comment, $flags, $scriptPath) # or die "UserSetAttributes() failed: $^E"; } }