Home All Groups Group Topic Archive Search About

Notify users to change their password before it get expired



Author
9 May 2005 9:26 AM
Bashar Badr
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

Author
9 May 2005 2:12 PM
Torgeir Bakken (MVP)
Bashar Badr wrote:

> 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.
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, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
Author
23 May 2005 2:43 PM
finny
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

Show quote
"Torgeir Bakken (MVP)" wrote:

> Bashar Badr wrote:
>
> > 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.
> 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, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
>
Author
9 May 2005 3:33 PM
Jim Vierra
I believe you can turn on password reminders in GP.

--
Jim Vierra

Show quote
"Bashar Badr" <BasharB***@discussions.microsoft.com> wrote in message
news:598577A1-6A55-4FF7-8E4F-2BB7D914CC7D@microsoft.com...
> 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
Author
9 May 2005 9:03 PM
Corné Bogaarts
That doesn't help users that only connect to a website such as Outlook Web
Access.

Show quote
On Mon, 9 May 2005 11:33:57 -0400, "Jim Vierra" <jvie***@msn.com> wrote:

>I believe you can turn on password reminders in GP.
Author
9 May 2005 9:16 PM
Jim Vierra
Torgeir also sent you a script link.  See his post at:
news:%23bvITGKVFHA.1200@TK2MSFTNGP14.phx.gbl...
--
Jim Vierra

"Corné Bogaarts" <does.not.ex***@somewhere.com> wrote in message
news:7tjv71lkvu6bebd6m7htgko5q2cnvq0rqp@4ax.com...
> That doesn't help users that only connect to a website such as Outlook Web
> Access.
>
> On Mon, 9 May 2005 11:33:57 -0400, "Jim Vierra" <jvie***@msn.com> wrote:
>
>>I believe you can turn on password reminders in GP.
>
Author
10 May 2005 4:39 AM
Corné Bogaarts
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.

Show quote
On Mon, 9 May 2005 17:16:10 -0400, "Jim Vierra" <jvie***@msn.com> wrote:

>Torgeir also sent you a script link.  See his post at:
>news:%23bvITGKVFHA.1200@TK2MSFTNGP14.phx.gbl...
Author
10 May 2005 5:24 AM
Jim Vierra
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

Show quote
"Corné Bogaarts" <does.not.ex***@somewhere.com> wrote in message
news:2ke08112foukp5shioj0arr5cp3tmu92m6@4ax.com...
> 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.
>
> On Mon, 9 May 2005 17:16:10 -0400, "Jim Vierra" <jvie***@msn.com> wrote:
>
>>Torgeir also sent you a script link.  See his post at:
>>news:%23bvITGKVFHA.1200@TK2MSFTNGP14.phx.gbl...
>

AddThis Social Bookmark Button