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

  • 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.

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: