|
|
|||||||
As the title says, I need to run part of my logon script ONLY on the first Monday of each month (for auditing PCs). Here's what runs right now, and the scheduling is done by the settings in the exe file. IF INGROUP("Domain Users") RUN '\\server\xxx.exe' ?Audit is running in the background" ENDIF However, the settings for the audit program don't allow you to specifiy something as specific as the first Monday of the month. If anyone has an example of something similar they would like to share, it would really help out. Thanks. |
||||||||
|
|
|||||||
haven't given it too much thought, but something like this might work Code:
|
||||||||
|
|
|||||||
ummm ... will this work ? Code:
this is only reliable of course if it runs every day of week |
||||||||
|
|
|||||||
dang ^~° |
||||||||
|
|
|||||||
Of course if one logs on many times on that Monday, it will run at every logon. Better to write a flag in the registry or an INI file or some other method to see if it had run already. |
||||||||
|
|
|||||||
your right Les, I knew there was something fishy with that ! |
||||||||
|
|
|||||||
yeah it's just a start. and like jochen pointed out, if nobody logs on that monday, it won't run either. so it is definitely lacking some needed logic. |
||||||||
|
|
|||||||
nope, it's reliable always. if a script is said to be run only on first monday, then it must not run otherwise, even though it would not run because of that for years. the code is reliable. just that the logic behind the ruling could be worked out a bit. like, "run once a month" would be neat. thus it would run on first logon of the month only, no matter what day it is. something like this: Code:
|
||||||||
|
|
|||||||
lol, I wrote little bit too long that Shiat! to those who wonder, it's reply to the jochens dang post |
||||||||
|
|
|||||||
ok. borrowing from jooel, maybe something like this would work Code:
|
||||||||
|
|
|||||||
ok, back to the problem ... implementing Les' suggestion, how about this : Code:
|
||||||||
|
|
|||||||
The prob with HKLM is perms. I really hate crap like that running at logon. It is this sort of thing that encourages users to never logoff. It should be setup as a sceduled task instead. |
||||||||
|
|
|||||||
beaten again K, I will quit posting for today |
||||||||
|
|
|||||||
Quote: That part I can take care of. There is an option in the settings for the exe that you select that makes it run only once a day. I've been too busy to try implementing any of the suggestions today, but I'll let you guys know what works. Thanks for the help, and keep the suggestions coming. |
||||||||
|
|
|||||||
If a script needs to run on mondays then I'd schedule it via the Task Scheduler, especially if it is an audit script. It would even run under a different user account, thus the chance that a user is closing the audit program is minimized. Also, the whole thing could be scheduled via admin script and no changes to a logon script are required. |
||||||||
|
|
|||||||
I think your idea of the first monday is still screwed up. you can never get 100% hit if you limit the audit to single day of the month. running it once a month is a different thing, and to that you got provided code on silver platter already. |