Add FormatDateTime(now,1) to logon script

10-22-2006, 08:14 AM

I would like to know how I can add good morning and afternoon, to my logon script.

It works now, but I would like to add the code in the comment section to the body of this logon script, but not have any more msgboxs popup, except the 1.

So that when the user logs on, he or she will get good morning or afternoon, with this code

& "Your User Name is: " & WshNetwork.UserName & VbCrLf _
********************************************************************** *****************

Dim WshNetwork
Dim WshShell

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Popup "Welcome to " & WshNetwork.UserDomain & "Domain" & vbCrLf _
& VbCrLf _
& "Your User Name is: " & WshNetwork.UserName & VbCrLf _
& VbCrLf _
& "You are a member of: " & (strGroups) & VbCrLf _
& VbCrLf _
& VbCrLf _
& "All Network Drives Mapped!" & VbCrLf _
& VbCrLf _
& VbCrLf _
& Space (16)& "Today's Date is: " & (FormatDateTime(Now(),vbLongDate))& VbCrLf _
& Space (16)& "Your Local System Time is: " & Time

'Comment Section


If InStr(now,"AM") Then
MsgBox "Good Morning"
MsgBox "Good Afternoon"
End If



10-22-2006, 10:34 AM
It would be better compare dates rather than using a string function on a date. Basically, find out what the time is and store just that in a variable. Then, create a time variable for noon. Then, you can just compare the two. If the time is after noon, then its afternoon, if it is before noon, its the morning.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum