NetworkGeezer Posted May 3, 2006 Posted May 3, 2006 Do you use a message of the day pop-up to convey information e.g. maintenance information. Do you use a login script or dedicated app?
Sylv3r Posted May 3, 2006 Posted May 3, 2006 I used something knocked up in visual basic. It is located on a shared drive and when a user logs on the script checks to see if the file exists. If it does it shows the message i.e. "USB Memory Pens for sale etc" with jpg or whatever. If the file doesnt exist nothing will be shown.
plexer Posted May 3, 2006 Posted May 3, 2006 Here's a vbs that will do the same thing reading from a text file if the file is empty nothing is displayed. Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile("C:\motd.txt") If objFile.Size > 0 Then Set objReadFile = objFSO.OpenTextFile("C:\motd.txt", 1) strContents = objReadFile.ReadAll Wscript.Echo strContents objReadFile.Close Else End If Ben
NetworkGeezer Posted May 3, 2006 Author Posted May 3, 2006 Won't that result in a lot of message boxes? one for each line
plexer Posted May 3, 2006 Posted May 3, 2006 Nope one message box displaying the contents of the file. Ben
ChrisH Posted May 3, 2006 Posted May 3, 2006 No the line : strContents = objReadFile.ReadAll Is dumping the whole file into one variable.
NetworkGeezer Posted May 3, 2006 Author Posted May 3, 2006 No the line : strContents = objReadFile.ReadAll Is dumping the whole file into one variable. :oops:
plexer Posted June 4, 2006 Posted June 4, 2006 Dim StrUsername, Strfilename, Strcomputername, Strmsglocation Strmsglocation = "c:\" Set objNetwork = WScript.CreateObject("WScript.Network") strUserName = objNetwork.UserName strcomputername =objNetwork.ComputerName Set objFSO = CreateObject("Scripting.FileSystemObject") if objFso.FileExists(Strmsglocation & "motd.txt") then strfilename = Strmsglocation & "motd.txt" else strfilename = Strmsglocation & "null.txt" end if Set objFile = objFSO.GetFile(strfilename) If objFile.Size > 0 Then Set objReadFile = objFSO.OpenTextFile(strfilename, 1) strContents = objReadFile.ReadAll Wscript.Echo strContents objReadFile.Close Else End If if objFso.FileExists(Strmsglocation & strusername & ".txt") then strfilename = Strmsglocation & strusername & ".txt" else strfilename = Strmsglocation & "null.txt" end if Set objFile = objFSO.GetFile(strfilename) If objFile.Size > 0 Then Set objReadFile = objFSO.OpenTextFile(strfilename, 1) strContents = objReadFile.ReadAll Wscript.Echo strContents objReadFile.Close Else End if if objFso.FileExists(Strmsglocation & strcomputername & ".txt") then strfilename = Strmsglocation & strcomputername & ".txt" else strfilename = Strmsglocation & "null.txt" end if Set objFile = objFSO.GetFile(strfilename) If objFile.Size > 0 Then Set objReadFile = objFSO.OpenTextFile(strfilename, 1) strContents = objReadFile.ReadAll Wscript.Echo strContents objReadFile.Close Else End if I've done a steroids version of the motd.vbs now you can show 3 messages the first is the normal message of the day, the second is specific to a username and the third is specific to a computer. You set the location of the files at the top of the script in the: Strmsglocation = "c:\" Variable. Wherever you set that to you need to create a text file called null.txt with nothing in it. motd.txt is the one you create for a system wide message of the day. The other 2 would be username.txt and computername.txt where username and computername are the particular ones you want to message. i.e 00test.txt or 18-01.txt What might be also useful is to have a group feature so that you could have say 18.txt and every machine in 18 would get the message. Hope this is useful to someone. Ben
ITWombat Posted June 4, 2006 Posted June 4, 2006 How about this: Attach the user motd to the relvant user init GPO or Attach the computer script to a loopack GPO for the OU which groups together the computers in a PC suite.
plexer Posted June 4, 2006 Posted June 4, 2006 Yes you could do those but then you have different copies of the motd script rather than just being able to have a bunch of .txt's in a folder. Ben
ITWombat Posted June 4, 2006 Posted June 4, 2006 Yeah. You have point there. To do group selection in monOlithic script you'd have t o use ADSI, KiXtart or string splitting in VBS.
mattx Posted January 23, 2007 Posted January 23, 2007 Nice and simple AutoIT script. Just 9 lines of code to do this sort of thing. ; 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', _ 'Test message for the St Johns Network Message Of The Day Program.' & @CRLF & _ @CRLF & _ 'Matt Marsh - IT Tech' & @CRLF & _ @CRLF & _ 'Click on OK to close this box.') if ($__msgbox = 1) Then Exit EndIf Will show this: http://img250.imageshack.us/img250/8434/motd2fx.jpg Compile it to an EXE and run it at logon.
plexer Posted January 23, 2007 Posted January 23, 2007 Nice and short but then you have to recompile it everytime you want to change the message? Ben
Geoff Posted January 23, 2007 Posted January 23, 2007 I use the venerable wFortune. http://www.progsoc.uts.edu.au/~timj/wfortune/
mattx Posted January 23, 2007 Posted January 23, 2007 Nice and short but then you have to recompile it everytime you want to change the message? Which takes seconds, which you can also do in Scite, or even just right clicking over the script.
webman Posted January 23, 2007 Posted January 23, 2007 Or modify it so it loads messages from a centrally-stored INI file.
mattx Posted January 23, 2007 Posted January 23, 2007 Yeah, you can do that - I've done that for a drive mapping script I wrote a while ago. As we only ever use this script maybe once or twice a year its not much bother just to change the syntax and then compile it....
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now