This is what I use, very lightly modified.
--
'========================================
' First, get the domain policy.
'========================================
Dim oDomain
Dim oUser
Dim maxPwdAge
Dim numDays
Dim warningDays
warningDays = 5
Set LoginInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & LoginInfo.UserName & "")
strDomainDN = UCase(LoginInfo.DomainDNSName)
strUserDN = LoginInfo.UserName
Set oDomain = GetObject("LDAP://" & strDomainDN)
Set maxPwdAge = oDomain.Get("maxPwdAge")
'========================================
' Calculate the number of days that are
' held in this value.
'========================================
numDays = CCur((maxPwdAge.HighPart * 2 ^ 32) + _
maxPwdAge.LowPart) / CCur(-864000000000)
'WScript.Echo "Maximum Password Age: " & numDays
'========================================
' Determine the last time that the user
' changed his or her password.
'========================================
Set oUser = GetObject("LDAP://" & strUserDN)
'========================================
' Add the number of days to the last time
' the password was set.
'========================================
whenPasswordExpires = DateAdd("d", numDays, oUser.PasswordLastChanged)
fromDate = Date
daysLeft = DateDiff("d",fromDate,whenPasswordExpires)
'WScript.Echo "Password Last Changed: " & oUser.PasswordLastChanged
if (daysLeft < warningDays) and (daysLeft > -1) then
CreateObject("WScript.Shell").Popup "Your Password Expires in " & daysLeft & "
day(s)" & " at " & whenPasswordExpires & chr(13) & chr(13) & "Please ensure
that you change your password BEFORE" & chr(13) & "its expiry time to prevent
any disruption of service." &chr(13) &chr(13) & "Any questions, please contact
the IT Helpdesk.", 4200, "PASSWORD EXPIRATION WARNING!"
End if
'========================================
' Clean up.
'========================================
Set oUser = Nothing
Set maxPwdAge = Nothing
Set oDomain = Nothing
--
Gavin Wilby
IT Support Engineer
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of David McSpadden
Sent: 27 May 2014 14:43
To: '[email protected]'
Subject: RE: [NTSysADM] Expiring Passwords
Have a link?
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Dave Lum
Sent: Tuesday, May 27, 2014 9:41 AM
To: [email protected]
Subject: RE: [NTSysADM] Expiring Passwords
I used to use the (probably) same VBScript, written my MBS perhaps? It runs as
a scheduled task on a single machine that queries a DC I believe.
The Netwrix solution can email both the user and an administrator, with the
administrator (or Helpdesk) getting a report of all users whose passwords are
going to expire in x number of days.
Dave
> Runs on each workstation?
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Gavin Wilby
> Sent: Tuesday, May 27, 2014 9:27 AM
> To: '[email protected]'
> Subject: RE: [NTSysADM] Expiring Passwords
>
> I found and then modified a vb script that runs every morning at 11am
> (pushed as a task via GPO), if your password is about to expire within
> 5 days it pops up a window telling you.
>
> This window then self closes after 100 minutes.
>
> I'm happy to share this if required.
>
> Gavin Wilby
> IT Support Engineer
>
> From:
> [email protected]<mailto:[email protected]>
> [mailto:[email protected]] On Behalf Of Charles F
> Sullivan
> Sent: 27 May 2014 14:18
> To: [email protected]<mailto:[email protected]>
> Subject: RE: [NTSysADM] Expiring Passwords
>
> http://technet.microsoft.com/en-us/library/ee829687(v=ws.10).aspx
>
>
> From:
> [email protected]<mailto:[email protected]>
> [mailto:[email protected]<mailto:[email protected]
> um.com>]
> On Behalf Of David McSpadden
> Sent: Tuesday, May 27, 2014 9:10 AM
> To: '[email protected]<mailto:[email protected]>'
> Subject: [NTSysADM] Expiring Passwords
>
> I am not sure what I have done in my Environment, AD 2008, Windows 7
> Pros’ but my Your Password is about to expire message hasn’t
> worked since going to Window 7.
>
> I am asking what does everybody else use to keep their users informed
> of their password is about to expire?
>
> I’ll wait for your replies.
> Thanks
> David
>
> This e-mail and any files transmitted with it are property of Indiana
> Members Credit Union, are confidential, and are intended solely for
> the use of the individual or entity to whom this e-mail is addressed.
> If you are not one of the named recipient(s) or otherwise have reason
> to believe that you have received this message in error, please notify
> the sender and delete this message immediately from your computer. Any
> other use, retention, dissemination, forwarding, printing, or copying
> of this email is strictly prohibited.
>
>
> Please consider the environment before printing this email.
> SMP Partners Limited, SMP Trustees Limited and SMP Fund Services
> Limited are licensed by the Isle of Man Financial Supervision
> Commission. SMP Accounting & Tax Limited is a member of the ICAEW
> Practice Assurance Scheme.
> SMP Partners Limited registered in the Isle of Man, Company
> Registration
> No: 000908V
> Directors: M.W. Denton, M.J. Derbyshire, P.N. Eckersley, S.E McGowan, O.
> Peck, J.J. Scott, S.J. Turner
> SMP Trustees Limited registered in the Isle of Man, Company
> Registration
> No: 068396C
> Directors: A.C. Baggesen, M.W. Denton, O. Peck, J.J. Scott, J.
> Watterson, J. Cubbon SMP Fund Services Limited registered in the Isle
> of Man, Company Registration No: 120288C
> Directors: V. Campbell, M.W. Denton, P.N. Eckersley, D.A. Manser, S.E
> McGowan, O. Peck, J.J. Scott, R.K. Corkill SMP Accounting & Tax
> Limited registered in the Isle of Man, Company Registration No:
> 001316V
> Directors: I.F. Begley, A.J. Cowley, A.J. Dowling, P. Duchars, P.N.
> Eckersley, J.J. Scott, S.J. Turner
> SMP Capital Markets Limited registered in the Isle of Man, Company
> Registration No: 002438V
> Directors: M.W. Denton, M.J. Derbyshire, D.F Hudson, S.E McGowan, O.
> Peck, J.J. Scott.
> SMP Partners Limited, SMP Trustees Limited, SMP Fund Services Limited,
> SMP Accounting & Tax Limited and SMP Capital Markets Limited are
> members of the SMP Partners Group of Companies.
>
> This email is confidential and is subject to disclaimers. Details can
> be found at: http://www.smppartners.com/disclaimer.html
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> This e-mail and any files transmitted with it are property of Indiana
> Members Credit Union, are confidential, and are intended solely for
> the use of the individual or entity to whom this e-mail is addressed.
> If you are not one of the named recipient(s) or otherwise have reason
> to believe that you have received this message in error, please notify
> the sender and delete this message immediately from your computer. Any
> other use, retention, dissemination, forwarding, printing, or copying
> of this email is strictly prohibited.
>
> Please consider the environment before printing this email.
>
This e-mail and any files transmitted with it are property of Indiana Members
Credit Union, are confidential, and are intended solely for the use of the
individual or entity to whom this e-mail is addressed. If you are not one of
the named recipient(s) or otherwise have reason to believe that you have
received this message in error, please notify the sender and delete this
message immediately from your computer. Any other use, retention,
dissemination, forwarding, printing, or copying of this email is strictly
prohibited.
Please consider the environment before printing this email.
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________