Description

This is another humorous script I wrote while waiting for my servers to patch. It greets you each day with a positive saying and includes your display name. You can run it as a startup script from a GPO and make your users feel special each day.

Source Code

Set oADSystemInfo = CreateObject("ADSystemInfo")

Set objShell = WScript.CreateObject("WScript.Shell")

' get user object
Set oADsUser = GetObject("LDAP://" & oADSystemInfo.UserName)


 
intHighNumber = 7
intLowNumber = 1
Dim answerstr(9)
' here you can add more answer choices for it pick from just change to two above numbers first
answerstr(1) = "Have a nice "
answerstr(2) = "Have a wonderful "
answerstr(3)= "Happy "
answerstr(4) = "Have a great "
answerstr(5) = "Congrats for it's "
answerstr(6)= "Welcome to  "
answerstr(7) = "Be thankful for "
   Randomize
    intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)	
daymsg = answerstr(intnumber)

dtmToday = Date()
dtmDayOfWeek = DatePart("w", dtmToday)

Select Case dtmDayOfWeek
    Case 1 tdaystr=  "Sunday"
    Case 2 tdaystr= "Monday"
    Case 3 tdaystr= "Tuesday"
    Case 4 tdaystr= "Wednesday"
    Case 5 tdaystr= "Thursday"
    Case 6 tdaystr= "Friday"
    Case 7 tdaystr= "Saturday"
End Select
'Custom message for Friday
if tdaystr="Friday" then 
x=MsgBox("TGIF!!! ", 64)
' this could be changed if your poor users have to work on the weekend
elseif tdaystr="Saturday" or tdaystr="Sunday" then
x=MsgBox("It's the weekend! ", 64)
else
x=MsgBox(daymsg & " " & tdaystr & " " &  oADsUser.FirstName, 64)
end if

Screenshots

happyday.jpg

6 Spice ups

Picture simulated. Your results may vary.

You can replace lines 26 - 37 with: tdaystr = WeekdayName(WeekDay(Now()))

Another way to do things would be to have a string with the comments like this: strComments = “comment 1:comment2:comment 3” Then make an array out of it: answerstr = Split(strComments,“:”) Then set your intHighNumber: intHighNumber = UBound(answerstr) Then you can add as many comments as you want without having to edit the script any further :slight_smile:

Last comment, honest :slight_smile: Don’t need line # 4. You define the object (objShell) then never do anything with it. Hope this all helps?!

Thanks for all the great tips. I always like to learn new ways to look at things and tricks.

All good stuff, but most of all Josh thanks for a fun script. It always helps to brighten folks day.

Thanks - it can’t hurt to try to cheer the ****s up can it!

I will use this to give a clue to a secret location and hide a treat for one lucky user to find, HR are gonna eat this up, well they will if they find it, haha.

This is pretty cool! Thanks for the share