Skip navigation

JSI Tip 6426. How do I unlock a user account in a script?


Joe Richards brings us Unlock to unlock the user account specified. When you type unlock /?, you receive:

Unlock V02.00.00cpp Joe Richards ([email protected]) March 2003

Usage:
 Unlock server account \[switches\]

   server     Domain Controller to unlock at (. is default DC)
   account    sAMAccountName filter to match on

  Switches: (designated by - or /)
   -dn        Display DN as well as sAMAccountName
   -view      View only, don't change anything.
   -force     Force 0 into pwdLastSet
   -value     Override default of only showing locked accounts
              and will show any account with a lockoutTime value.
   -all       Override default of only showing locked accounts
              and will show any account that matches filter.
   -utc       Date/Time in UTC instead of local time.
   -t xxx     Timeout for LDAP calls in seconds. Default 120.
   -b BaseDN  BaseDN to start search at for userid

  Ex1:
    unlock dc1 username
      Unlock username on domain controller dc1
  Ex2:
    unlock . username
      Unlock username on default domain controller
  Ex3:
    unlock . * -view
      Find locked accounts on default domain controller
  Ex3:
    unlock . *
      Find and unlock locked accounts on default domain controller

 This software is Freeware. Use it as you wish at your own risk.
 If you have improvement ideas, bugs, or just wish to say Hi, I
 receive email 24x7 and read it in a semi-regular timeframe.
 You can usually find me at [email protected]
NOTE: See How can I tell if an account is expired, disabled, locked, etc...?



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish