Enum users to change acct expiration date

Discussion in 'Scripting' started by David Mueller, Sep 26, 2003.

  1. I need to change the AD user's account expiration date of
    all users in a container.

    I can enumerate the users but I can't seem to find the
    correct syntax to modify the account expiration date
    property. Any help is appreciated. Thanks.


    PS - I also need to change the account expr date in NDS.
    I assume I use the NDS:// instead of the LDAP:// ADSI
    service provider, right?

    Thanks.
     
    David Mueller, Sep 26, 2003
    #1
    1. Advertisements

  2. Wow... stupid stupid stupid. I got it. Silly spelling
    errors.

    For anyone else wondering... (and this is a little custom
    to my tree, of course)


    Dim strSiteName
    strSiteName = "MySite"

    Set objOU = GetObject("LDAP://ou=users,ou=" & strSiteName
    & ",ou=fba,ou=XYZ,dc=prod,dc=ent,dc=xyz,dc=com")
    objOU.Filter = Array("user")

    For Each objUser In objOU
    objUser.AccountExpirationDate = "09/30/2006"
    objUser.SetInfo
    wscript.echo "changed " & objuser.name
    Next
     
    David Mueller, Sep 26, 2003
    #2
    1. Advertisements

  3. But I don't know the NDS:// syntax yet.
     
    David Mueller, Sep 26, 2003
    #3
  4. David Mueller

    Mark Ohde Guest

    Try this.

    Set objUser = GetObject _
    ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
    objUser.AccountExpirationDate = "03/30/2003"
    objUser.SetInfo

    This should change the account expiration date.

    Mark R. Ohde, MCP, MCSA, MCSE, MCT, CCNA
     
    Mark Ohde, Sep 26, 2003
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.