Page 1 of 1

Fellow computer geeks, I need your help.

Posted: Mon May 30, 2005 9:27 pm
by Mr. Poopypants
I have a login script for a windows domain, I need to insert a command into the script that will only run the script on Wednesday.Is there a way to do this and what is the sytax?

Re: Fellow computer geeks, I need your help. (Mr. Poopypants)

Posted: Mon May 30, 2005 9:35 pm
by millster
What language is your script? VBScript?

Re: Fellow computer geeks, I need your help. (millster)

Posted: Mon May 30, 2005 9:44 pm
by Mr. Poopypants
Straight DOS login script, nothing fancy.

Re: Fellow computer geeks, I need your help. (Mr. Poopypants)

Posted: Mon May 30, 2005 10:40 pm
by millster
Well... that does bump the difficulty up significantly (as I haven't used a straight batch file in a while). I'll see if I can dredge anything up, but as memory serves there aren't any date related functions for a batch file.

Re: Fellow computer geeks, I need your help. (millster)

Posted: Mon May 30, 2005 10:43 pm
by Mr. Poopypants
Quote, originally posted by millster »Well... that does bump the difficulty up significantly (as I haven't used a straight batch file in a while). I'll see if I can dredge anything up, but as memory serves there aren't any date related functions for a batch file.Yeah, I'm going old school. I think there is a way but I have been searching and can't find anything that is useful.

Re: Fellow computer geeks, I need your help. (Mr. Poopypants)

Posted: Mon May 30, 2005 11:02 pm
by joatmon
what version of windows? Is it a batch program, or a script in a switch.inf file? Do you want the script to run every wednesday, or to run every day and then just do something special if it is wednesday?If it's a batch file, you can set up a scheduled task to run every wednesday, so that the script gets run only on wednesday, and the script itself doesn't care what day it is.

Re: Fellow computer geeks, I need your help. (joatmon)

Posted: Mon May 30, 2005 11:05 pm
by Mr. Poopypants
It's actually a few diffrent versions of windows that will be using the script. And it is just a batch that is initiated by the PDC on logon. Is there a way to include the script in the scheduled tasks without going to every computer and adding it in?I have not done scripts in forever, so I am really rusty.

Re: Fellow computer geeks, I need your help. (Mr. Poopypants)

Posted: Mon May 30, 2005 11:49 pm
by joatmon
if it's a batch file, something like this might work. Probably a fancier way to do it, and you'd need to change the temp file location to a place where the user can create a fileQuote »date /T > c:pptest1.txtset WEDNESDAY=for /F "tokens=1" %%i in (c:pptest1.txt) do if %%i EQU Wed set WEDNESDAY=truedel c:pptest1.txtif DEFINED WEDNESDAY goto :dostuffgoto :donothing:dostuffecho All the cool poopypants stuff happens here:donothing

Re: Fellow computer geeks, I need your help. (joatmon)

Posted: Mon May 30, 2005 11:51 pm
by Mr. Poopypants
Dayum!Thanks a bunch joat, I'll give that a shot.

Re: Fellow computer geeks, I need your help. (Mr. Poopypants)

Posted: Tue May 31, 2005 7:01 am
by NSimkins
Quote, originally posted by Mr. Poopypants »And it is just a batch that is initiated by the PDC on logon. Just curious, you mention a PDC. Are you running an older Windows NT domain (PDC/BDC) or Win2k/2k3 active directory?

Re: Fellow computer geeks, I need your help. (NSimkins)

Posted: Tue May 31, 2005 8:38 pm
by Mr. Poopypants
Quote, originally posted by NSimkins »Just curious, you mention a PDC. Are you running an older Windows NT domain (PDC/BDC) or Win2k/2k3 active directory?It's actually a mixed network (read:My boss has no clue what he's doing)We have mostly Win2k but there are a few NT servers. We are running AD but my boss has no clue how to use it IMHO and so we are using yesterday's technology tomorrow.In my last job, we had all Win2K3. I LOVE IT! Using active directory cut my leg work in half because I didn't have to go around to each computer to make any config changes.

Re: Fellow computer geeks, I need your help. (joatmon)

Posted: Tue May 31, 2005 9:13 pm
by ullbergm
Quote, originally posted by joatmon »if it's a batch file, something like this might work. Probably a fancier way to do it, and you'd need to change the temp file location to a place where the user can create a fileFYI... If you want to get rid of the temp file this works for me (atleast on xp)Quote »set WEDNESDAY=for /F "tokens=1" %%i in ('date /t') do if %%i EQU Wed set WEDNESDAY=trueif DEFINED WEDNESDAY goto :dostuffgoto :donothing:dostuffecho All the cool poopypants stuff happens here:donothing

Re: Fellow computer geeks, I need your help. (joatmon)

Posted: Tue May 31, 2005 9:20 pm
by Mr. Poopypants
Joat, I gave that a shot and since it's wednesday, it worked, I changed the day in the script to Thursday and ran it and it still ran, it didn't just close.*edit* Nevermind, I'm a dope!

Re: Fellow computer geeks, I need your help. (ullbergm)

Posted: Tue May 31, 2005 10:28 pm
by joatmon
I tried that, but used back tick instead of apostrophe (` instead of ' ) and couldn't make it work so I went with the temp file. I'll blame it on Cursed unix csh influence it's happy with an apostrophe, thanks. i'm on XP also, not sure if date /T works on older windows versions.Can also cut out a few more lines by making it:Quote »set WEDNESDAY=for /F "tokens=1" %%i in ('date /t') do if %%i EQU Wed set WEDNESDAY=trueif NOT DEFINED WEDNESDAY goto :donothingecho All the cool poopypants stuff happens here:donothingand to make it run on a different day change Wed to Thu, Fri, Sat, etc in the for line

Re: Fellow computer geeks, I need your help. (joatmon)

Posted: Tue May 31, 2005 10:33 pm
by ullbergm
Quote, originally posted by joatmon »I tried that, but used back tick instead of apostrophe (` instead of ' ) and couldn't make it work so I went with the temp file. I'll blame it on Cursed unix csh influence it's happy with an apostrophe, thanks. i'm on XP also, not sure if date /T works on older windows versions.lol, i did to. and then i figured i'd try it with '.. here is yet another variation of the scriptQuote »for /F "tokens=1" %%i in ('date /t') do goto %%igoto end:Wedecho Doing stuffgoto end:Mon:Tue:Thu:Fri:Sat:Sungoto end:end

Re: Fellow computer geeks, I need your help. (joatmon)

Posted: Tue May 31, 2005 10:36 pm
by Mr. Poopypants
OK, everything is working great. Thank you for all your help!!