Help with AD Script for setting password never expires

Home Forums Scripting Windows Script Host Help with AD Script for setting password never expires

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    Managor
    Member
    #151306

    So I’ve just been tasked with setting the “Password Never Expires” for our “TS Users” group on a WS2003 AD, I’ve been trying to modify this code –>

    Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
    strOU = “ou=TS Users”
    strDomain = “pls.com”

    set objRootDSE = GetObject(“LDAP://”&strDomain&”/RootDSE”)
    set objParent = GetObject(“LDAP://”&strOU&”,”(objRootDSE.Get(“defaultNamingContext”)))

    intUAC = objUser.Get(“userAccountControl”)
    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[/CODE]

    But can’t get it work for some reason, would any one mind telling me where I went wrong? My newbness at VBS smacks me hard. :-x[CODE]Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
    strOU = “ou=TS Users”
    strDomain = “pls.com”

    set objRootDSE = GetObject(“LDAP://”&strDomain&”/RootDSE”)
    set objParent = GetObject(“LDAP://”&strOU&”,”(objRootDSE.Get(“defaultNamingContext”)))

    intUAC = objUser.Get(“userAccountControl”)
    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[/CODE]

    But can’t get it work for some reason, would any one mind telling me where I went wrong? My newbness at VBS smacks me hard. :-x

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.