Title: Message
If you are trying to unlock an account or something like that, here is a code snippit from a script I have that does that.
 
sub IsAccountLocked
 {
 Win32::AdminMisc::UserGetMiscAttributes($ServerName,$WhoAmI,\%Tribs);
 $LockedOut = $Tribs{USER_FLAGS} & UF_LOCKOUT;
 if ($LockedOut)
  {
  print "\n\nThis account is locked out, would you like to unlock it?";
  print "\n(Y/N)?  ";
  chomp($answer = <STDIN>);
  if ($answer =~ /^[yY]/)
   {
   $Tribs{USER_FLAGS} = $Tribs{USER_FLAGS} & ~UF_LOCKOUT;
   Win32::AdminMisc::UserSetMiscAttributes($ServerName,$WhoAmI,USER_FLAGS,$Tribs{USER_FLAGS});
   Win32::AdminMisc::UserGetMiscAttributes($ServerName,$WhoAmI,\%Tribs);
   $LockedOut = $Tribs{USER_FLAGS} & UF_LOCKOUT;
   if ($LockedOut)
    {
    print "\n\n FATAL UNEXPECTED ERROR!";
    print "\nContact Support!";
    die "\nOperation Failed: $!";
    } # end of nested nested if
    else
     {
     print "\n\nAccount unlocked successfully.";
     } # end of else
   } # end of nested if
  } # end of if
  else
   {
   print "\n\n$WhoAmI is not locked out.";
   } # end of else
 } # end of sub IsAccountLocked
-----Original Message-----
From: Jahsman Dan L [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 12:38 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: AdminMisc Question

How do I find out what is in the $Flags variable.  When I run
 
UserGetAttributes($Server, $UserName, $UserFullName, $Password, $PasswordAge,
$Privilege, $HomeDir, $Comment, $Flags, $ScriptPath)
 
$Flags comes back with a number.
 
I am interested in finding out what the value of UF_LOCKOUT is and what I need to do to change the value with 
 
UserSetAttributes($Server, $UserName, $UserFullName, $Password, $PasswordAge,
$Privilege, $HomeDir, $Comment, $Flags, $ScriptPath)
 
Thanks for your assistance,
dan

Reply via email to