Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help calculating dates

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
US
Hi guys
I have a script I've modified to go through the user accounts in the domain and get the password expire date based on our password expire policy of 90 days. Everything works great. I'm having an issue when sending an email to the users. I want to put a date when they need to change their passwords instead of a number of days. In the email subject the variable strNoOfDays is correct it'll say your password expires in 7 days or whatever. But the strChangeDate is not working. Help. Here's the script.

Code:
'==========================================================================
' 
' NAME: Password Notification
' 
' AUTHOR: Gene Magerr
' EMAIL: genemagerr@hotmail.com
'
' COMMENT: Original Script by [URL unfurl="true"]www.d2ww.com[/URL] Modified by Gene Magerr
'
' VERSION HISTORY:
' 1.0   10/03/2007  Initial release
'
'==========================================================================
' VBScript Prefix Naming Standard
'==========================================================================
' arr	Array       Contains an array of variables.
' bln   Boolean     Can contain either True or False
' byt   Byte        Integer value in the range of 0 to 255.
' col   Collection  Technically, a collection is not a variable subtype. 
'                   It is mentioned in this table because it is good 
'                   practice to use the col  prefix to indicate a collection. 
'                   Collections are used extensively in system administration
'                   scripts.
' Const Constant    Constant values contain no prefix and use UPPER Case
'                   letters with underscores. Constants cannot be altered
'                   like normal variables.
' cur   Currency    Range of -922,337,203,685,477.5808 to 
'                   922,337,203,685,477.5807
' dbl   Double      Contains a double-precision floating-point number in 
'                   the range
' dic   Dictionary  Scripting dictionaries
' dtm   Date (Time) either a Date, Time, or Date and Time
' err   Error       Contains an error number value.
' fun   Functions   Programatic Function
' g_    Globals     Variables with global scope
' int   Integer     Contains integer value in the range of -32,768 to 32,767.
' lng   Long        Contains an integer value in the range -2,147,483,648 To
'                   2,147,483,647.
' obj   Object      Contains a reference to an Object.
' sng   Single      Contains a single-precision floating-point number 
' str   String      A variable length string of textual data
' sub   Subroutines Programatting SubRouting
' var   Variant     A variable that can store different data types at 
'                   different times.
'==========================================================================
Option Explicit

'==========================================================================
' If TestMode is set to true, all wscript.echo messages will be displayed,
' if set to False no messages are displayed
'==========================================================================
TestMode = False

'==========================================================================
' VARIABLE DECLARATIONS
'==========================================================================
Dim objCommand
Dim objConnection
Dim strBase 
Dim objFSO 
Dim TestMode 
Dim objFile
Dim strFilter
Dim strAttributes
Dim strPasswordChangeDate
Dim intPassAge
Dim lngTZBias
Dim objPwdLastSet
Dim strEmailAddress
Dim objShell 
Dim lngBiasKey 
Dim k 
Dim PasswordExpiry 
Dim strRootDomain
Dim strQuery 
Dim objRecordset 
Dim strName 
Dim strCN
Dim strNoOfDays
Dim strChangeDate
Dim strPasswordExpiry
Dim strFirstName
Dim strLastName

'==========================================================================
' STATIC VARIABLE ASSIGNMENTS
'==========================================================================
Const FOR_READING = 1, FOR_WRITING = 2, FOR_APPENDING = 8

'==========================================================================
' MAIN SCRIPT CODE
'==========================================================================
'If TestMode = True Then
'WScript.Echo "Put Message Here"
'End If

'==========================================================================
' Set the password expiration time and the domain
'==========================================================================
PasswordExpiry = 90
strRootDomain = "dc=mycompany,dc=org"

'==========================================================================
' Get the Active time on the Server
'==========================================================================
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

'==========================================================================
' Connect to Active Directory
'==========================================================================
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://" & strRootDomain & ">"

'==========================================================================
' Filter to exclude users that have "password never expires"
' or "password not required" set.
'==========================================================================
strFilter = "(&(objectCategory=person)(objectClass=user)" _
    & "(!userAccountControl:1.2.840.113556.1.4.803:=65536)" _
    & "(!userAccountControl:1.2.840.113556.1.4.803:=32))"
strAttributes = "SN,givenName,sAMAccountName,cn,mail,pwdLastSet"
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

'==========================================================================
' Create the folder C:\logs if it doesn't exsist.
'==========================================================================
Set objFSO = CreateObject("Scripting.FilesystemObject")
If Not objFSO.FolderExists("C:\logs") Then
objFSO.CreateFolder("C:\logs")
End If

'==========================================================================
' Create the text file userpwd.txt in the C:\logs directory.
'==========================================================================
If Not objFSO.FileExists("C:\logs\userspwd.txt") Then
objFSO.CreateTextFile("C:\logs\userpwd.txt")
End If
 
Set objFile = objFSO.OpenTextFile("C:\logs\userpwd.txt", 8, True)

Do Until objRecordSet.EOF
	strEmailAddress = objRecordSet.Fields("mail").value
    strFirstName = objRecordSet.Fields("givenName").Value
    strLastName = objRecordset.Fields("SN").Value
    If strName = "" Then
    strName = objRecordSet.Fields("samAccountName").Value
    Else
    strName = strFirstName & " " & strLastName
    End If
    strCN = objRecordSet.Fields("cn").Value
    
If strEmailAddress <> "" Then

    'objFile.WriteLine "NT Name: " & strName & ", Common Name: " & strCN
    Set objPwdLastSet = objRecordset.Fields("pwdLastSet").Value

    strPasswordChangeDate = Integer8Date(objPwdLastSet, lngTZBias)
    'objFile.WriteLine vbTab & "Password last changed at " & strPasswordChangeDate
    intPassAge = DateDiff("d", strPasswordChangeDate, Now)
    'objFile.WriteLine vbTab & "Password changed " & intPassAge & " days ago"
    
    strChangeDate = DateAdd("d",PasswordExpiey,Date()) 
    
     If intPassAge = (PasswordExpiry - 1) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 1 day"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 1)
    
    ElseIf intPassAge = (PasswordExpiry - 2) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 2 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 2)
    
    ElseIf intPassAge = (PasswordExpiry - 3) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 3 days" 
    objFile.WriteLine strEmailAddress & vbCrLf
    'Call SendEmailMessage(strEmailAddress, 3)
    
    ElseIf intPassAge = (PasswordExpiry - 4) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 4 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 4)
    
    ElseIf intPassAge = (PasswordExpiry - 5) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 5 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 5)
    
    ElseIf intPassAge = (PasswordExpiry - 6) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 6 days"   
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 6)
    
    ElseIf intPassAge = (PasswordExpiry - 7) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 7 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 7)
       
    ElseIf intPassAge = (PasswordExpiry - 14) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 14 days"
	objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 14)
    
    ElseIf intPassAge > (PasswordExpiry) Then
    objFile.WriteLine strName & vbCrLf & "Your password is " & intPassAge & " days old. "
    objFile.WriteLine strEmailAddress & vbCrLf
    
    End If
End If

    objRecordSet.MoveNext

Loop

objConnection.Close

Function Integer8Date(objDate, lngBias)
    Dim lngAdjust, lngDate, lngHigh, lngLow

    lngAdjust = lngBias
    lngHigh = objDate.HighPart
    lngLow = objdate.LowPart
    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
    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

'==========================================================================
' SUBS AND FUNCTIONS
'==========================================================================

Sub SendEmailMessage(strDestEmail, strNoOfDays)
    Dim objMessage

    If (strDestEmail = "") Then
        Wscript.Echo "No email address, no message sent."
        Exit Sub
    End If

    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "Password Expires in " & strNoOfDays & " days"
    objMessage.Sender = "gmagerr@mycompany.org"
    objMessage.To = "gmagerr@mycompany.org" 'strDestEmail

objMessage.TextBody = objMessage.TextBody & "On " & strChangeDate & ", the network password for " & strName & " will expire on unclassified systems." & vbCrLf  
objMessage.TextBody = objMessage.TextBody & "Before that date (there is no grace period), please change your password." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "IMPORTANT: Do not use a password you have used before." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "If you have questions or need assistance, call the Computing Helpdesk, x6000." & vbCrLf

objMessage.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objMessage.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "mail.mycompany.org"
objMessage.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objMessage.Configuration.Fields.Update
objMessage.Send

'objMessage.Send
End Sub
 
First off...you misspelled your variable.

strChangeDate = DateAdd("d",PasswordExpiey,Date())

Next if you now it will expire in say 7 days you could also try. Date - 7

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Thanks dm4ever I just figured it out. This actually worked.

I figured it out
Dim CalcDate
CalcDate = (PasswordExpiry - intPassAge )
strChangeDate = DateAdd("d",CalcDate,Date())
 
dm4ever is there a way to add the day of the week? heres what I'm getting

On 10/15/2007, the network password for

Can I get something like

On Sunday 10/15/07, the network

Or whatever the day of the week is for that date

Thanks.
 
WScript.Echo WeekdayName(Weekday(CDate("10/15/2007")))

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Thanks dm4ever I figured it out.

Code:
Dim CalcDate
CalcDate = (PasswordExpiry - intPassAge ) 
strChangeDate = DateAdd("d",CalcDate,Now()) 
strPWChangeDate = FormatDateTime(strChangeDate, vbLongDate)
 
Guys
Here is the finished version, it seems to do the job quite nicely. Thanks for all the input. To get this to actually email to your users, you'd have to remove gmagerr@mycompany.org and un-comment strDestEmail in the objMessage.To portion of the script. It's towards the bottom.

Code:
'==========================================================================
' 
' NAME: Password Notification
' 
' AUTHOR: Gene Magerr
' EMAIL: genemagerr@hotmail.com
'
' COMMENT: Original Script by [URL unfurl="true"]www.d2ww.com[/URL] Modified by Gene Magerr
'
' VERSION HISTORY:
' 1.0   10/03/2007  Initial release
'
'==========================================================================
' VBScript Prefix Naming Standard
'==========================================================================
' arr	Array       Contains an array of variables.
' bln   Boolean     Can contain either True or False
' byt   Byte        Integer value in the range of 0 to 255.
' col   Collection  Technically, a collection is not a variable subtype. 
'                   It is mentioned in this table because it is good 
'                   practice to use the col  prefix to indicate a collection. 
'                   Collections are used extensively in system administration
'                   scripts.
' Const Constant    Constant values contain no prefix and use UPPER Case
'                   letters with underscores. Constants cannot be altered
'                   like normal variables.
' cur   Currency    Range of -922,337,203,685,477.5808 to 
'                   922,337,203,685,477.5807
' dbl   Double      Contains a double-precision floating-point number in 
'                   the range
' dic   Dictionary  Scripting dictionaries
' dtm   Date (Time) either a Date, Time, or Date and Time
' err   Error       Contains an error number value.
' fun   Functions   Programatic Function
' g_    Globals     Variables with global scope
' int   Integer     Contains integer value in the range of -32,768 to 32,767.
' lng   Long        Contains an integer value in the range -2,147,483,648 To
'                   2,147,483,647.
' obj   Object      Contains a reference to an Object.
' sng   Single      Contains a single-precision floating-point number 
' str   String      A variable length string of textual data
' sub   Subroutines Programatting SubRouting
' var   Variant     A variable that can store different data types at 
'                   different times.
'==========================================================================
Option Explicit

'==========================================================================
' If TestMode is set to true, all wscript.echo messages will be displayed,
' if set to False no messages are displayed
'==========================================================================
TestMode = False

'==========================================================================
' VARIABLE DECLARATIONS
'==========================================================================
Dim objCommand
Dim objConnection
Dim strBase 
Dim objFSO 
Dim TestMode 
Dim objFile
Dim strFilter
Dim strAttributes
Dim strPasswordChangeDate
Dim intPassAge
Dim lngTZBias
Dim objPwdLastSet
Dim strEmailAddress
Dim objShell 
Dim lngBiasKey 
Dim k 
Dim PasswordExpiry 
Dim strRootDomain
Dim strQuery 
Dim objRecordset 
Dim strName 
Dim strCN
Dim strNoOfDays
Dim strPWChangeDate
Dim strChangeDate
Dim strPasswordExpiry
Dim strFirstName
Dim strLastName
Dim strEmployeeID
Dim strLoginName
Dim CalcDate
Dim objMessage

'==========================================================================
' STATIC VARIABLE ASSIGNMENTS
'==========================================================================
Const FOR_READING = 1, FOR_WRITING = 2, FOR_APPENDING = 8

'==========================================================================
' MAIN SCRIPT CODE
'==========================================================================
'If TestMode = True Then
'WScript.Echo "Put Message Here"
'End If

'==========================================================================
' Set the password expiration time and the domain
'==========================================================================
PasswordExpiry = 90
strRootDomain = "dc=mycompany,dc=org"

'==========================================================================
' Get the Active time on the Server
'==========================================================================
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

'==========================================================================
' Connect to Active Directory
'==========================================================================
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://" & strRootDomain & ">"

'==========================================================================
' Filter to exclude users that have "password never expires"
' or "password not required" set.
'==========================================================================
strFilter = "(&(objectCategory=person)(objectClass=user)" _
    & "(!userAccountControl:1.2.840.113556.1.4.803:=65536)" _
    & "(!userAccountControl:1.2.840.113556.1.4.803:=32))"
strAttributes = "employeeID,SN,givenName,sAMAccountName,cn,mail,pwdLastSet"
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

'==========================================================================
' Create the folder C:\logs if it doesn't exsist.
'==========================================================================
Set objFSO = CreateObject("Scripting.FilesystemObject")
If Not objFSO.FolderExists("C:\logs") Then
objFSO.CreateFolder("C:\logs")
End If

'==========================================================================
' Create the text file userpwd.txt in the C:\logs directory.
'==========================================================================
If Not objFSO.FileExists("C:\logs\userspwd.txt") Then
objFSO.CreateTextFile("C:\logs\userpwd.txt")
End If
 
Set objFile = objFSO.OpenTextFile("C:\logs\userpwd.txt", 8, True)

Do Until objRecordSet.EOF
	strName = objRecordset.Fields("samAccountName").Value
	strEmployeeID = objRecordset.Fields("employeeID").Value
	strEmailAddress = objRecordSet.Fields("mail").value
'    strFirstName = objRecordSet.Fields("givenName").Value
'    strLastName = objRecordset.Fields("SN").Value
'    If strName = "" Then
'    strName = objRecordSet.Fields("samAccountName").Value
'    Else
'    strName = strFirstName & " " & strLastName
'    End If
    strCN = objRecordSet.Fields("cn").Value
    
If strEmployeeID <> "" Then

    'objFile.WriteLine "NT Name: " & strName & ", Common Name: " & strCN
    Set objPwdLastSet = objRecordset.Fields("pwdLastSet").Value

    strPasswordChangeDate = Integer8Date(objPwdLastSet, lngTZBias)
    'objFile.WriteLine vbTab & "Password last changed at " & strPasswordChangeDate
    intPassAge = DateDiff("d", strPasswordChangeDate, Now)
    'objFile.WriteLine vbTab & "Password changed " & intPassAge & " days ago"
    
    CalcDate = (PasswordExpiry - intPassAge ) 
    strChangeDate = DateAdd("d",CalcDate,Now()) 
	strPWChangeDate = FormatDateTime(strChangeDate, vbLongDate)
    
    If intPassAge = (PasswordExpiry - 1) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 1 day"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 1)
    
    ElseIf intPassAge = (PasswordExpiry - 2) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 2 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 2)
    
    ElseIf intPassAge = (PasswordExpiry - 3) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 3 days" 
    objFile.WriteLine strEmailAddress & vbCrLf
    'Call SendEmailMessage(strEmailAddress, 3)
    
    ElseIf intPassAge = (PasswordExpiry - 4) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 4 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 4)
    
    ElseIf intPassAge = (PasswordExpiry - 5) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 5 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 5)
    
    ElseIf intPassAge = (PasswordExpiry - 6) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 6 days"   
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 6)
    
    ElseIf intPassAge = (PasswordExpiry - 7) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 7 days"
    objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 7)
       
    ElseIf intPassAge = (PasswordExpiry - 14) Then
    objFile.WriteLine strName & vbCrLf & "Your password expires in 14 days"
	objFile.WriteLine strEmailAddress & vbCrLf
    Call SendEmailMessage(strEmailAddress, 14)
    
    ElseIf intPassAge > (PasswordExpiry) Then
    objFile.WriteLine strName & vbCrLf & "Your password is " & intPassAge & " days old. "
    objFile.WriteLine strEmailAddress & vbCrLf
    
    End If
End If

    objRecordSet.MoveNext

Loop

objConnection.Close

Function Integer8Date(objDate, lngBias)
    Dim lngAdjust, lngDate, lngHigh, lngLow

    lngAdjust = lngBias
    lngHigh = objDate.HighPart
    lngLow = objdate.LowPart
    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
    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

'==========================================================================
' SUBS AND FUNCTIONS
'==========================================================================

Sub SendEmailMessage(strDestEmail, strNoOfDays)
    
    If (strDestEmail = "") Then
        Wscript.Echo "No email address, no message sent."
        Exit Sub
    End If

    Set objMessage = CreateObject("CDO.Message")
    If strNoOfDays = 1 Then
      	objMessage.Subject = "Password Expires in " & strNoOfDays & " day"
    Else  
    	objMessage.Subject = "Password Expires in " & strNoOfDays & " days"
    End If

objMessage.Sender = "gmagerr@mycompany.org"
objMessage.To = "gmagerr@mycompany.org" 'strDestEmail

objMessage.TextBody = objMessage.TextBody & "On " & strPWChangeDate & ", the network password for loginname " & strName & " will expire on unclassified systems." & vbCrLf  
objMessage.TextBody = objMessage.TextBody & "Before that date (there is no grace period), please change your password." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "IMPORTANT: Do not use a password you have used before." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "If you have questions or need assistance, call the Computing Helpdesk, x6000." & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf 
objMessage.TextBody = objMessage.TextBody & "Instructions for Changing Your Network Password" & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf
objMessage.TextBody = objMessage.TextBody & "You must be connected to the mycompany network, either in the office or via VPN tunnel." & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf
objMessage.TextBody = objMessage.TextBody & "Windows 2000/XP" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  1.  Press <Ctrl + Alt + Delete>." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  2.  In the window that opens, click Change Password." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  3.  As prompted, type your old password, type your new password" & vbCrLf 
objMessage.TextBody = objMessage.TextBody & "      (not one you have used before), and retype your new password" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      to confirm it. Click OK." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  4.  When notified that your password has been successfully changed," & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      click OK." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  5.  Click Cancel to return to your work." & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf
objMessage.TextBody = objMessage.TextBody & "Macintosh" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "Note: For an illustrated version of these instructions, see [URL unfurl="true"]http://intranet.mycompany.org/computing/passchg.html"[/URL] & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  1.  Make sure your mycompany email program is not running." & vbCrLf 
objMessage.TextBody = objMessage.TextBody & "  2.  In your Web browser, go to [URL unfurl="true"]https://pw.mycompany.org/iisadmpwd/aexp.htr"[/URL] & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      If prompted for your old and new passwords, skip to step 5." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      Otherwise continue at step 3." & vbCrLf   
objMessage.TextBody = objMessage.TextBody & "  3.  If a dialog box headed ""Connect to 'pw.mycompany.org' as"" appears:" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      --In the User ID field type mycompany\loginname (example: mycompany\jdoe)." & vbCrLf 
objMessage.TextBody = objMessage.TextBody & "      --In the Password field type your current network password." & vbCrLf 
objMessage.TextBody = objMessage.TextBody & "      Click OK." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  4.  If a security notice appears, click OK or Continue." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  5.  The ""Changing Password..."" window opens, with your loginname in parentheses." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      --In the Old password field, type your current password." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "      --As prompted, type your new password twice." & vbCrLf
objMessage.TextBody = objMessage.TextBody & "  6.  Click Change." & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf
objMessage.TextBody = objMessage.TextBody & "What Is a Network Password?" & vbCrLf
objMessage.TextBody = objMessage.TextBody & vbCrLf
objMessage.TextBody = objMessage.TextBody & "A network password gives Mac and Windows users access to their email on an Exchange server" & vbCrLf
objMessage.TextBody = objMessage.TextBody & "and to network resources such as Shasta and Lassen drops. In addition," & vbCrLf
objMessage.TextBody = objMessage.TextBody & "Windows users need their network password to log in to the Windows network." & vbCrLf

objMessage.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objMessage.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "mail.mycompany.org"
objMessage.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objMessage.Configuration.Fields.Update
objMessage.Send

'objMessage.Send
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top