Announcement

Collapse
No announcement yet.

AccountExpires

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • AccountExpires

    Hello

    How can I change the accountExpires attribute of a user in AD (W2k3) by script or with a tool ?


    I would like to do something like this :

    atool.exe param1 param2
    with param1=User in AD (cn=...,ou=... )
    and param2=dd/mm/yyyy (expiration date of the account)

    Thanks for responses

  • #2
    Like this http://www.joeware.net/win/free/tools/accexp.htm ?
    Guy Teverovsky
    "Smith & Wesson - the original point and click interface"

    Comment


    • #3
      AccountExpires

      Thanks

      I tried it but it doesn't work with ActiveDirectory only for local users

      Comment


      • #4
        vb script

        Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000

        UserName = username
        strOU = "ou=ouname"
        strDomain = "domainname.local"
        set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE")
        set objParent = GetObject("LDAP://" & strOU & "," & _
        objRootDSE.Get("defaultNamingContext"))
        intUAC = username
        objParent.Filter = Array("user")
        for each objUser in objParent
        If ADS_UF_DONT_EXPIRE_PASSWD AND intUAC Then
        else
        objUser.Put "userAccountControl", intUAC XOR _
        ADS_UF_DONT_EXPIRE_PASSWD
        objUser.SetInfo
        end if
        next
        MCSE 2000\2003, A+
        00000001-00000011-00000011-00000111

        Comment


        • #5
          Re: AccountExpires

          Originally posted by Tlocki
          Thanks

          I tried it but it doesn't work with ActiveDirectory only for local users
          It does. If running not from DC, use the /s <DC Name> option. Something like:
          Code:
          X:\Tools>accexp support 8/5/05 /s descartes
          
          AccExp V01.01.00cpp Joe Richards ([email protected]) August 2002
          
          Account Expires: 8/5/2005 1:00 AM
          Setting...
          Account Expires: 8/5/2005 1:00 AM
          
          The command completed successfully
          
          X:\Tools>accexp support /s descartes
          
          AccExp V01.01.00cpp Joe Richards ([email protected]) August 2002
          
          Account Expires: 8/5/2005 1:00 AM
          
          The command completed successfully
          
          X:\Tools>
          Guy Teverovsky
          "Smith & Wesson - the original point and click interface"

          Comment


          • #6
            AccountExpires

            Thank you for all

            Comment

            Working...
            X