how to send password Expirt notification to user
Hi Experts,
i have Exchange Server 2007 and appliead password policy on Domain.
some my user are using their mails with POP3 and used to login with local Computer user name and password. so they are not able to view password change message.
pls help me how can i sned to a notification to all users whose password are going to expire.
Thanks in Advance
Balwan Singh
July 3rd, 2010 8:52am
Hi ,
Read this and I hope you will be able to do it.
http://forums.msexchange.org/m_1800513465/mpage_1/key_/tm.htm#1800513477
Regards.
Shafaquat Ali.
M.C.I.T.P Exchange 2007/2010, M.C.I.T.P Windows Server 2008, M.C.T.S OCS Server 2007 R2
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2010 11:46am
Hi Balwan,
Exchange does not have this feature. You need to using Exchange API to create a program or script. Please also see the following post:
http://theessentialexchange.com/blogs/michael/archive/2007/11/13/sending-an-e-mail-to-users-whose-password-is-about-to-expire.aspx
July 9th, 2010 9:23am
I've been using the powershell script from this
http://social.technet.microsoft.com/Forums/en/ITCG/thread/c35e7c1e-d5c1-421c-999a-7affeacd1668
I run the script once a week and it sends email notifications to users with less then 10 days until their password expires
Free Windows Admin Tool Kit Click here and download it now
July 9th, 2010 12:37pm
Hi Pls Find the Script . itw working fne from my send..
A Notification Mail will drop to user whose password going to expire.
find the contents
Dear User Name,
Your password for Login ID is going to expire in n
days. For last time you have changed your password on 6/15/2010 5:44:03 PM. Please change the login password immediately to prevent further logon problems.
Click the following link to change your password now:
https://mail.yourdomain.com
For any help Please contact Local IT Helpdesk Team
Thank you!
This is an automatically generated message.
Here is Script. just copy and save it in .vbs
Option Explicit
Dim objCommand, objConnection, objChild, objUserConnection, strBase, strFilter, strAttributes, strPasswordChangeDate, intPassAge
Dim lngTZBias, objPwdLastSet, strEmailAddress, objMessage
Dim objShell, lngBiasKey, k, PasswordExpiry, strRootDomain
Dim strQuery, objRecordset, strName, strCN, strFN, strLN
' ********************* CHANGE THESE VALUES TO PASSWORD EXPIRY AND ROOT OF WHERE USERS WILL BE SEARCHED ***********************************
PasswordExpiry=45
strRootDomain="DC=Cosmo,DC=COM"
' *****************************************************************************************************************************************
' Obtain local Time Zone bias from machine registry.
Set objShell = CreateObject("Wscript.Shell")
lngBiasKey = objShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
If UCase(TypeName(lngBiasKey)) = "LONG" Then
lngTZBias = lngBiasKey
ElseIf UCase(TypeName(lngBiasKey)) = "VARIANT()" Then
lngTZBias = 0
For k = 0 To UBound(lngBiasKey)
lngTZBias = lngTZBias + (lngBiasKey(k) * 256^k)
Next
End If
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://" & strRootDomain & ">"
' ********************* USER FILTERING LIKE DISABLE ACCOUNTS ***********************************
strFilter = "(&(objectCategory=person)(objectClass=user))"
'strFilter = "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=65536))"
'strFilter = ((objectCategory=person)(objectClass=user)(userAccountControl1.2.840.113556.1.4.803:=2) (!userAccountControl:1.2.840.113556.1.4.803:=65536))"
strAttributes = "sAMAccountName,distinguishedName,mail,pwdLastSet,cn,givenName,sn"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
' WScript.echo "Running at " & Date()
Do Until objRecordSet.EOF
strName = objRecordSet.Fields("sAMAccountName").Value
strCN = objRecordSet.Fields("cn").value
strFN = objRecordSet.Fields("givenName").value
strLN = objRecordSet.Fields("sn").value
strEmailAddress = objRecordSet.Fields("mail").value
Wscript.Echo "NT Name: " & strName & ", Common Name: " & strCN
Set objUserConnection = GetObject("LDAP://" & Replace(objRecordSet.Fields("distinguishedName").Value, "/", "\/"))
Set objPwdLastSet = objUserConnection.pwdLastSet
strPasswordChangeDate = Integer8Date(objPwdLastSet, lngTZBias)
WScript.Echo vbTab & "Password last changed at " & strPasswordChangeDate
intPassAge = DateDiff("d", strPasswordChangeDate, Now)
WScript.Echo vbTab & "Password changed " & intPassAge & " days ago"
' ********************* DAYS CONFIGURATION FOR SCANNING ***********************************
If intPassAge = (PasswordExpiry-1) Then
WScript.echo vbTab & "Sending user notification to " & strEmailAddress & " that password expires in 1 days"
Call SendEmailMessage(strEmailAddress, 1)
ElseIf intPassAge = (PasswordExpiry-2) Then
WScript.echo vbTab & "Sending user notification to " & strEmailAddress & " that password expires in 2 days"
Call SendEmailMessage(strEmailAddress, 2)
ElseIf intPassAge = (PasswordExpiry-3) Then
WScript.echo vbTab & "Sending user notification to " & strEmailAddress & " that password expires in 3 days"
Call SendEmailMessage(strEmailAddress, 3)
ElseIf intPassAge = (PasswordExpiry-6) Then
WScript.echo vbTab & "Sending user notification to " & strEmailAddress & " that password expires in 6 days"
Call SendEmailMessage(strEmailAddress, 6)
ElseIf intPassAge = (PasswordExpiry-9) Then
WScript.echo vbTab & "Sending user notification to " & strEmailAddress & " that password expires in 9 days"
Call SendEmailMessage(strEmailAddress, 9)
End If
objRecordSet.MoveNext
Loop
objConnection.Close
Function Integer8Date(objDate, lngBias)
' Function to convert Integer8 (64-bit) value to a date, adjusted for
' local time zone bias.
Dim lngAdjust, lngDate, lngHigh, lngLow
lngAdjust = lngBias
lngHigh = objDate.HighPart
lngLow = objdate.LowPart
' Account for error in IADslargeInteger property methods.
If lngLow < 0 Then
lngHigh = lngHigh + 1
End If
If (lngHigh = 0) And (lngLow = 0) Then
lngAdjust = 0
End If
lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow) / 600000000 - lngAdjust) / 1440
' Trap error if lngDate is overly large
On Error Resume Next
Integer8Date = CDate(lngDate)
If Err.Number <> 0 Then
On Error GoTo 0
Integer8Date = #1/1/1601#
End If
On Error GoTo 0
End Function
' ********************* EMAIL CONFIGURATION DETAILS ***********************************
Sub SendEmailMessage(strDestEmail, strNoOfDays)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Your Password expires in " & strNoOfDays & " days"
objMessage.Sender = "PASSWORD.ADMIN@STEL.IN"
objMessage.From="PASSWORD.ADMIN@STEL.IN"
objMessage.To = strDestEmail
objMessage.cc = "BALWAN.SINGH@STEL.IN"
objMessage.HTMLBody = "<html> <head><style>div {font-family: tahoma,verdana,arial;font-size: 11px;color: #38465A;}td {font-family: tahoma,verdana,arial;font-size: 11px;color: #38465A;}a {color: #38465A;}.dt {background-color:#DDE1E8;color:
#556988;font-weight: bold;padding-left: 4px;}.dt1 {background-color: #F1F3F6;}.dt2 {background-color: #F8F9FA;}</style><div> </head> <Body>Dear " & strFN &" " & strLN &",<BR> <BR> Your password <B>
" & strName & " </B>is going to expire in <B> " & strNoOfDays & " </B>days. For last time you have changed your password on <B> " & strPasswordChangeDate & "</B>. Please change the login password immediately
to prevent further logon problems.<BR> <BR> Click the following link to change your password now:<BR><BR>Internal Users <a href=https://mail.stel.in/owa </a> Change Password. <BR><BR> <a>External Users
</a><a href=https://mail.yourdomain.com/owa </a> Change Password.<BR><a <BR> <BR> Thank you!<BR> <BR> This is an automatically generated message.</a> </Body> </html>"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
' ********************* 'Name or IP of Remote SMTP Server ***********************************
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "FQDN Name of Exchange Server"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Set objMessage = nothing
End Sub
July 21st, 2010 8:25am
Hi Balwan,
Thank you for sharing!
Free Windows Admin Tool Kit Click here and download it now
July 21st, 2010 11:56am