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!

Add FormatDateTime(now,1) to logon script

Status
Not open for further replies.

Netman06

Technical User
Aug 15, 2006
70
US
Hello,

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

FormatDateTime(now,1)

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

Thanks,

Mike
 
Change the 'MsgBox' in the test to a variable; call the test before the popup; add the result to the parsing of the popup.

For example...

Code:
Dim WshNetwork
Dim WshShell

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")

If InStr(now,"AM") Then
    greet = "Good Morning"
Else
    greet =  "Good Afternoon"
End If

WshShell.Popup "Welcome to " & WshNetwork.UserDomain & "Domain" & vbCrLf _
& VbCrLf _
& greet & ". 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

FormatDateTime(now,1)

Hope this helps...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top