+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
Scripts Thread, message of the day bat in Coding and Web Development; i need to create a script that when a user logs on it will display a message but only for ...
  1. #1
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    message of the day bat

    i need to create a script that when a user logs on it will display a message but only for the first login for that day. i was thinking of using a net send command which runs once and the users pick it up when they log in but i cant rember it thats the case. i know net send sends a message if i done it to a group of users when they log in do they still get the message. or is it just loged on users get it. any help would be really good. ( its to sort out a problem i have IE message of the day remember that the network will be going down for 5 mins at 1200 today for maintaince. )

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,998
    Thank Post
    120
    Thanked 280 Times in 258 Posts
    Rep Power
    106

    Re: message of the day bat

    You can send net send to a machine or even the whole domain with the domain switch. You do however need the messenger service running which is disabled by default in XP SP2. You can obviously enable this in a GPO should you wish.
    Which ever machines are on at the time will receive the message.

  3. #3

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180

    Re: message of the day bat

    Don't forget to think of all the hilarious ways in which the little darlings can get to the command to send messages to each other.

  4. #4

    Join Date
    Mar 2007
    Posts
    323
    Thank Post
    6
    Thanked 7 Times in 6 Posts
    Rep Power
    16

    Re: message of the day bat

    You could prehaps use AutoIT to run once on the logon script. So somewhere in the logon script, execute "autoit.exe dailymessage.au3" and withing the script basically check to see if its ran at all that day, if not message else quit and continue to logon.

    Prehaps use timestamps or something.

    Which brings me onto another topic... has anyone converted to autoit either for logon scripts or as a very helpful admin tool for basically anything?

    I love it personally but the other tech's dont use it because they dont like automation that much. Yet they love it when i role out updates using it weird ey

  5. #5
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    i like the last one but i am not good at writing scripts. what i was thinking was doing somthing like net send * message of the day then next line hello whats up ect and the when they log on they will get the message.
    but i dont know if it buffers it till the user logs on i know it used to on nt.

  6. #6
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    Quote Originally Posted by techyphil
    You could prehaps use AutoIT to run once on the logon script. So somewhere in the logon script, execute "autoit.exe dailymessage.au3" and withing the script basically check to see if its ran at all that day, if not message else quit and continue to logon.

    Prehaps use timestamps or something.

    Which brings me onto another topic... has anyone converted to autoit either for logon scripts or as a very helpful admin tool for basically anything?

    I love it personally but the other tech's dont use it because they dont like automation that much. Yet they love it when i role out updates using it weird ey

    i do like this idea if anyone can help with this it would be great the other way i was thinking was using limit login and if the records use that as a time strap and add it into the llogin.vbs maybe

  7. #7

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: message of the day bat

    You could use this as a template:

    ; AutoIt Version: 3
    ; Language: English
    ; Platform: WinXP
    ; Author: Matt Marsh
    ; Script Function: Message Of The Day Program

    $__msgbox = MsgBox(64, 'St Johns Network Message Of The Day', _
    'YOUR MESSAGE HERE.' & @CRLF & _
    @CRLF & _
    'NP & MM - IT Tech' & @CRLF & _
    @CRLF & _
    'Click on OK to close this box.')
    if ($__msgbox = 1) Then
    Exit
    EndIf
    I would add [ to make it only work on the first login ] a flag which could be either a time stamp or a simple file copy on a dat or txt file. So next time they logon if the file exsists then it won't display the message or the other way round depending on how you like your IFs..... :-)

  8. #8

    Join Date
    Jun 2005
    Location
    Preston, Lancashire
    Posts
    634
    Thank Post
    11
    Thanked 6 Times in 6 Posts
    Rep Power
    21

    Re: message of the day bat

    Quote Originally Posted by techyphil
    ...they dont like automation that much.
    8O
    Surely the goal of any Network Manager is to develop his, or her, network into an entity he, or she, can just sit back and watch running itself?

    Maybe it's just me.



    Andy

  9. Thanks to andy from:

    hawc (28th February 2013)

  10. #9

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: message of the day bat

    has anyone converted to autoit either for logon scripts or as a very helpful admin tool for basically anything?
    I have loads of AutoIT scripts running at logon just as plain Exe's.
    I did the simple Office Bar which some other schools are using, see thread:

    http://www.edugeek.net/index.php?nam...t=6266&start=0

    Also done a quick launcher app for staff:



    A rather OTT admin bar for myself when I logon as Admin to a workstation.....



    I use it for logging, quick and dirty password generators, copying over relevant Application Data files. Loads of uses.....
    Best thing [ I think I wrote ] was a script which clears out users files apart from anything thats in a folder called keepme. Run that during the summer !!

  11. #10
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    can i ask a really silly question like how do i run a autoit script on the network do i have to install autoit on every pc. sorry for being just never done scripting of any sort i can do basic bat and vbs but thats it.

  12. #11

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: message of the day bat

    Depends on how you have written the script, mine tend to run straight from a networked share, [ after I have compiled them ]

  13. #12
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    thats how i run all my scripts via the login and logoff via ad but how do i get somthing life that to run do i save it as a vbs

  14. #13

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: message of the day bat

    Quote Originally Posted by alonebfg
    thats how i run all my scripts via the login and logoff via ad but how do i get somthing life that to run do i save it as a vbs
    AutoIT is not a vbs script - you can compile it first as an .EXE or install the relevant files on the relevant PC / Server and associate it.
    Hope that helps.

  15. #14
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    so do you so would you run a bat ie
    start test.exe
    also i have written this can you just check it fo me i have tested it but not sure that its that good but it is the frist script i have ever written any recomended changes would be of greate help have rem one of the $file lines the remed ot version is the one i would use on the network
    Code:
     
    #include <Date.au3>
    #include <File.au3>
    
    $motd =  _DateTimeFormat(_NowCalc(),1)& @CRLF & "You are reminded that the A3 printers are out of use today" & @CRLF & "From Network Admin"
    ;for future use have not tested if i can save to here
    ;$file = "@AppDataDir\mod\logind.txt"
    $file = "c:\logind.txt"
    $t = FileGetTime($file)	
    $date = _DateDiff ( 'h',$t[0] & "/" & $t[1] & "/" & $t[2] & " " & $t[3] & ":" & $t[4] & ":" & $t[5],_NowCalc())
    ; checks to see age of file and finds diffreace if mor than 9 hours old send mesage else ends
    If 	$date > 9 Then
    	MsgBox(0,"Message Of The Day",$motd)
    	_FileWriteToLine($file, 1, _DateTimeFormat(_NowCalc(),0), 1)
    EndIf
    ;this section checks to see if a notepad is in the file
    Func OnAutoItStart ()
    ; will be using a text file in a share for motd but have not got it sorted yet
    	$motd =  _DateTimeFormat(_NowCalc(),1)& @CRLF & "You are reminded that the A3 printers are out of use today" & @CRLF & "From Network Admin"
    	$file = "c:\logind.txt"
    ;$file = "@AppDataDir\mod\logind.txt"
    	if FileExists($file) Then 
    	return 
    	ElseIf _FileCreate($file) Then
    	return MsgBox(0,"Message Of The Day",$motd)
    	EndIf
    EndFunc
    ps sorry about the remarks in it its to help me

  16. #15

    Join Date
    Nov 2006
    Posts
    22
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    16

    Re: message of the day bat

    I'd like to remind everyone of this previous post:

    http://www.edugeek.net/index.php?nam...highlight=motd


    Stephen Fletcher
    ICT Curriculum Technician
    Easington Community School

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Message of the day
    By googlemad in forum Netware
    Replies: 0
    Last Post: 7th November 2007, 10:29 AM
  2. Message of the Day - yes again!
    By alan-d in forum How do you do....it?
    Replies: 1
    Last Post: 28th March 2007, 11:32 AM
  3. Message of the day application
    By NetworkGeezer in forum How do you do....it?
    Replies: 16
    Last Post: 23rd January 2007, 11:11 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •