Jump to content

Recommended Posts

Posted
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. )
Posted

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.

Posted
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.
Posted

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

Posted

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.

Posted
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

Posted

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..... :-)

Posted
...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

  • Thanks 1
Posted
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?name=Forums&file=viewtopic&t=6266&start=0

 

Also done a quick launcher app for staff:

 

http://img149.imageshack.us/img149/2717/quickwm5.jpg

 

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

 

http://img86.imageshack.us/img86/9173/adminbarzm8.jpg

 

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 !!

Posted
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.
Posted
Depends on how you have written the script, mine tend to run straight from a networked share, [ after I have compiled them ]
Posted
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.

Posted

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

 
#include 
#include 

$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

Posted
The Problem i have is that most of them will display the message evertime you log in the one i have just done creates a file to compare dates and so will only disply it once a day
Posted

#include 
#include 

$motd =  _DateTimeFormat(_NowCalc(),1)& @CRLF &  FileReadLine("\\server\mod.txt",1) & @CRLF & FileReadLine("\\server\mod.txt",2) & @CRLF & FileReadLine("\\server\mod.txt",3)  & @CRLF & "From Network Admin"
;for future use have not tested if i can save to here
$file = @AppDataDir&"\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 > 10 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 & FileReadLine("\\server\mod.txt",1) & @CRLF & FileReadLine("\\server\mod.txt",2) & @CRLF & FileReadLine("\\server\mod.txt",3) & @CRLF & "From Network Admin"
;$file = "c:\logind.txt"
$file = @AppDataDir&"\logind.txt"
if FileExists($file) Then 
return 
ElseIf _FileCreate($file) Then
return MsgBox(0,"Message Of The Day",$motd)
EndIf
EndFunc

ok i have done it and it works really well it only sends a message once a day it does the by dropping a file in the apps folder and comparing mod dates when user logs in and if it is older than 10 hours it edits it to create a new mod date. am going to look at doing this in vbs now. it take the mod from a txt file on a share on the server. and if i have no massage i just put welcome to school on the txt file as they only recive it once no harm done.

Posted

Hey mattx I love that idea of the floating type tool bar.

 

Urm if it helps I also created like a delprof as the MS version didnt delete all of the users profiles.

 

$paths = "C:\Documents and Settings"
$search = FileFindFirstFile($paths &"\*.*")  

If $search = -1 Then
   MsgBox(0, "Error", "No files/directories matched the search pattern")
   Exit
EndIf

While 1
   $file = FileFindNextFile($search) 
   If @error Then ExitLoop
   	If $file <> "Administrator" AND _
   $file <> "All Users" And _
   $file <> "Default User" THEN
    If StringInStr(FileGetAttrib($file), "D") Then
       	DirRemove($file, 1)
   EndIf
Endif
WEnd

FileClose($search)

 

Urm hope that helps :) might save trying to put things in 1 folder first.

 

Yeh I suggested if we cant manage the workstations from the server logon scripts then I add schedualled tasks such as defrag + cleanup once a week to keep them running at a better rate rather then doing it once a year. That wasnt liked either - "you cant just automate everything". I think its a basic task and why the hell not?

 

They said that it means we cant check the physical state.. well that maybe the case but I will still go around cleaning them with a duster anyway a few times a year, just means its 1 less thing to have to perform whilst cleaning the machines. Umm arg :(

 

Lmao

 

Neways - you guys and girls rule :)

 

 

Cheers

Posted
Hey mattx I love that idea of the floating type tool bar.

 

Its handy I have to say, there are some more tools I'll add over the easter hols if I get time. [ Plus I really need to remove the not so needed gx which goes down the side. Thats really OTT - I only used that as a temp solution but never got round to changing it !! ]

Thanks for your pointer on the profs, may have to incorperate that in the next version...

Code of the admin bar is as follows if you want to mess with it....

 

; AutoIt Version: 3.10

; Language: English

; Platform: WinXP

; Author: Matt Marsh

; Script Function: Launches GUI For Admin Controls

; Version: 1 BETA

 

#include

 

GUICreate(" Admin Bar ", 150, 700, 20, 20)

GUICtrlCreatePic(@ScriptDir & "\mattsadminbar3.jpg", 60, 10, 66, 659)

GUICtrlSetState(-1, $GUI_DISABLE)

GUISetBkColor(0x0066FF)

$n1 = GUICtrlCreateIcon(@ScriptDir & "\rdp.ico", -1, 10, 20, 20)

GUICtrlCreateLabel("RDP", 10, 60)

GUICtrlSetTip(-1, "Remote Access")

$n2 = GUICtrlCreateIcon(@ScriptDir & "\delprof.ico", -1, 10, 80, 80)

GUICtrlCreateLabel("DelProf", 10, 120)

GUICtrlSetTip(-1, "Delete Local Profiles")

$n3 = GUICtrlCreateIcon(@ScriptDir & "\fpolicy.ico", -1, 10, 140, 140)

GUICtrlCreateLabel("Fpolicy", 10, 180)

GUICtrlSetTip(-1, "Force Policy Update")

$n4 = GUICtrlCreateIcon(@ScriptDir & "\wexplore.ico", -1, 10, 200, 200)

GUICtrlCreateLabel("Files", 10, 240)

GUICtrlSetTip(-1, "Windows Explorer")

$n5 = GUICtrlCreateIcon(@ScriptDir & "\reboot.ico", -1, 10, 260, 260)

GUICtrlCreateLabel("Reboot", 10, 300)

GUICtrlSetTip(-1, "Reboot Computer")

$n6 = GUICtrlCreateIcon(@ScriptDir & "\Scd.ico", -1, 10, 320, 320)

GUICtrlCreateLabel("Srv CD", 10, 360)

GUICtrlSetTip(-1, "Map Drive To Server CD Rom")

$n7 = GUICtrlCreateIcon(@ScriptDir & "\wupdate.ico", -1, 10, 380, 380)

GUICtrlCreateLabel("Win Upt", 10, 420)

GUICtrlSetTip(-1, "Force Windows Update From SUS Server")

$n8 = GUICtrlCreateIcon(@ScriptDir & "\vnc.ico", -1, 10, 440, 440)

GUICtrlCreateLabel("VNC", 10, 480)

GUICtrlSetTip(-1, "Run VNC Session")

$n9 = GUICtrlCreateIcon(@ScriptDir & "\appman.ico", -1, 10, 500, 500)

GUICtrlCreateLabel("Prism", 10, 540)

GUICtrlSetTip(-1, "Prism Application")

$n10 = GUICtrlCreateIcon(@ScriptDir & "\userman.ico", -1, 10, 560, 560)

GUICtrlCreateLabel("User Mgr", 10, 600)

GUICtrlSetTip(-1, "CSE User Manager")

$n11 = GUICtrlCreateIcon(@ScriptDir & "\appmgr.ico", -1, 10, 620, 620)

GUICtrlCreateLabel("App Mgr", 10, 660)

GUICtrlSetTip(-1, "CSE Application Manager")

GUISetState(@SW_SHOW)

 

; All test to see if Icons work !!

 

While 1

$bpress = GUIGetMsg()

Select

Case $bpress = $n1

Run('c:\windows\system32\mstsc.exe /v:server01 /console /f')

Case $bpress = $n2

Run('l:\delprof\delprof.exe')

Case $bpress = $n3

Run('\\stjohns01\apps\misc\force policy.cmd')

Case $bpress = $n4

Run('c:\windows\explorer.exe')

Case $bpress = $n5

Run('l:\matt\reboot.cmd')

Case $bpress = $n6

Run('l:\matt\server cd.cmd')

Case $bpress = $n7

Run('l:\sus\nwsusutil.exe server01')

Case $bpress = $n8

Run('p:\misc\vnc-4.0-x86_win32_viewer.exe')

Case $bpress = $n9

Run('f:\network toolkit\application manager\prism pack\paedit.exe')

Case $bpress = $n10

Run('f:\network toolkit\user manager\cse user manager.exe')

Case $bpress = $n11

Run('c:\program files\cse application manager\cse application manager.exe')

EndSelect

WEnd

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...