Notify users to change their password before it get expired

Discussion in 'Scripting' started by Bashar Badr, May 9, 2005.

  1. Bashar Badr

    Bashar Badr Guest

    Hi,
    is there a script to check the password age for the user and send pop-up
    message to him before his passwordget expired.
    for example: i want a pop-up message to come to any user before 2 days from
    his passoed expire date.

    thanx
     
    Bashar Badr, May 9, 2005
    #1
    1. Advertisements

  2. Hi

    Assuming AD domain:

    How Long Until My Password Expires?
    http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting09102002.asp


    Or using the PasswordLastChanged property:

    '--------------------8<----------------------

    Const SEC_IN_DAY = 86400
    Const ADS_UF_PASSWD_CANT_CHANGE = &H40
    Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000

    ' Specify how many days before the dialog box will be shown
    iExpireDayBeforePasswordExpireDialog = 2

    Set oNetwork = CreateObject("Wscript.Network")
    Set oADsSysInfo = CreateObject("ADSystemInfo")

    sNetBIOSDomain = oNetwork.UserDomain

    Set oDomainNT = GetObject("WinNT://" & sNetBIOSDomain)

    'Get MaxPasswordAge from Active Directory
    iMaxPwdAge = oDomainNT.Get("MaxPasswordAge")


    ' Retrieve password information for current user
    sADsUser = oADsSysInfo.UserName

    Set oUserLDAP = GetObject("LDAP://" & sADsUser)
    lngFlag = oUserLDAP.Get("userAccountControl")
    sPasswdLastChange = oUserLDAP.PasswordLastChanged

    blnPwdExpire = True
    If (lngFlag And ADS_UF_PASSWD_CANT_CHANGE) <> 0 Then
    blnPwdExpire = False
    End If
    If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) <> 0 Then
    blnPwdExpire = False
    End If

    If blnPwdExpire = True Then
    iMaxPasswdAgeValue = iMaxPwdAge / SEC_IN_DAY
    'Calculate days to password expires
    iDaysToPasswordExpires = Int((sPasswdLastChange + iMaxPasswdAgeValue) - Now)

    If iDaysToPasswordExpires =< iExpireDayBeforePasswordExpireDialog Then
    sInfoMessage = "Your Windows/Active Directory password will expire in " _
    & iDaysToPasswordExpires & " day(s)."
    'Display messagebox
    MsgBox sInfoMessage, vbSystemModal+vbInformation, "Password Expire Check"
    End If
    End If

    '--------------------8<----------------------
     
    Torgeir Bakken \(MVP\), May 9, 2005
    #2
    1. Advertisements

  3. Bashar Badr

    Jim Vierra Guest

    I believe you can turn on password reminders in GP.
     
    Jim Vierra, May 9, 2005
    #3
  4. That doesn't help users that only connect to a website such as Outlook Web
    Access.
     
    Corné Bogaarts, May 9, 2005
    #4
  5. Bashar Badr

    Jim Vierra Guest

    Torgeir also sent you a script link. See his post at:
     
    Jim Vierra, May 9, 2005
    #5
  6. No he didn't, he sent it to Bashar Badr.
    Please reply to the correct message in the thread. Especially since you don't
    include the original message in your answers.
     
    Corné Bogaarts, May 10, 2005
    #6
  7. Bashar Badr

    Jim Vierra Guest

    Hey - I gave you a link to the exact message in my last post and it IS in
    this thread.

    Anyway - sorry if I confused you. It was my intention to be helpful.
     
    Jim Vierra, May 10, 2005
    #7
  8. Bashar Badr

    finny Guest

    Hi,
    Also have a similar requirement.I visited the site u have given and tried
    the code.I am working in asp.net . It is throwing some error. "Cannot create
    ActiveX component"
    Kindly tell me. Its very urgent

    Regards
    Finny
     
    finny, May 23, 2005
    #8
  9. Bashar Badr

    Schimmel1113

    Joined:
    Jun 8, 2011
    Messages:
    2
    Likes Received:
    0
    Schimmel1113, Jul 15, 2011
    #9
    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.