Scheduled Task Question
the_erickee
Member Posts: 74 ■■□□□□□□□□
This doesnt pertain to the test but to something I have been assigned here at work...
I have to come up with some way to schedule a massive system reboot every night for about 50 of our new workstations. What i have came up with was making a scheduled task for the reboot using shutdown.exe -r -f and everything goes great on my machine. but when i copy the task to a shared folder on the network, and i put it into other people's pc's, the username and password changes to theirs and they dont have the rights assigned to them to run the task.
So what I'm asking is if there is a way to push out a mandatory restart everynight at midnight other than the way im doing it. BTW all the pc's use XP Pro. Thats why i put it in this section.
Thanks in advance!
I have to come up with some way to schedule a massive system reboot every night for about 50 of our new workstations. What i have came up with was making a scheduled task for the reboot using shutdown.exe -r -f and everything goes great on my machine. but when i copy the task to a shared folder on the network, and i put it into other people's pc's, the username and password changes to theirs and they dont have the rights assigned to them to run the task.
So what I'm asking is if there is a way to push out a mandatory restart everynight at midnight other than the way im doing it. BTW all the pc's use XP Pro. Thats why i put it in this section.
Thanks in advance!
Erick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+
Comments
-
Essendon Member Posts: 4,546 ■■■■■■■■■■Nightwatchman does it at my company. It's not free but it does its job. Without using 3rd party software, perhaps a GPO for the new PC's that forces a shutdown after logon hours expire or something. Here's the link for Nightwatchman,
http://www.1e.com/softwareproducts/nightwatchman/ -
astorrs Member Posts: 3,139 ■■■■■■□□□□Since its only 50 clients, why not use "shutdown -r -m \\computername" to reboot them all from a single computer. Use a VBScript (or a batch file with a for loop) to execute it for each of the computers (stored in a text file perhaps?). It will be much easier to administer from one machine than 50.
If you need some help in figuring out the details, just let us know. -
Essendon Member Posts: 4,546 ■■■■■■■■■■astorrs wrote:Since its only 50 clients, why not use "shutdown -r -m \\computername" to reboot them all from a single computer. Use a VBScript (or a batch file with a for loop) to execute it for each of the computers (stored in a text file perhaps?). It will be much easier to administer from one machine than 50.
If you need some help in figuring out the details, just let us know.
I'll probably let the experts take over -
the_erickee Member Posts: 74 ■■□□□□□□□□We are actually trying to keep it local on each machine. Any other ideas?Erick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+ -
astorrs Member Posts: 3,139 ■■■■■■□□□□the_erickee wrote:We are actually trying to keep it local on each machine. Any other ideas?
-
ranjitcool Member Posts: 80 ■■□□□□□□□□just un plug the fuse circuit of the room and put it back in :P
oh wait u guys might have ups.. damn it.. ok unplug the ups then
rjCleared Network+, MCTS.
Want to clear - CCSA, CCNA, VCP for now.
Spending time @ www.itgrunts.com - Tech Juice, Not from Concentrate! -
the_erickee Member Posts: 74 ■■□□□□□□□□^^ Lol. yeah that might work.
I think we are going to have to just go around to everyone's pc and set it up manually. Oh well. Thanks for the responses!Erick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+ -
ranjitcool Member Posts: 80 ■■□□□□□□□□or u can write a script that will sent a force reboot .
remember before sp2 was out we used to have some problem with the shutdown thingy in windows xp where u get a message with a 1 minute timer.
it was fixed by sp2 and even now when i use my univ lab, the lab admin, who is a jack a** (will let u know why) bugs me by sending me that count down.
i run a command sometimes like shutdown -f or something of that sort to stop it. mostly it fails!
he has a way to stop it too.
i will ask him how to do it and the right terminology.
i hope u got the idea. i think its called rpc shutdown, however it wud reboot the system.
so u wud have to write that command in a script either loop thru it 50 times or write it 50 times (if u r single loop thru it and get home quick, other wise spend time and type it 50 times )
makes sense ?
rjCleared Network+, MCTS.
Want to clear - CCSA, CCNA, VCP for now.
Spending time @ www.itgrunts.com - Tech Juice, Not from Concentrate! -
ranjitcool Member Posts: 80 ■■□□□□□□□□this is what i am talking about
Cleared Network+, MCTS.
Want to clear - CCSA, CCNA, VCP for now.
Spending time @ www.itgrunts.com - Tech Juice, Not from Concentrate! -
astorrs Member Posts: 3,139 ■■■■■■□□□□the_erickee wrote:^^ Lol. yeah that might work.
I think we are going to have to just go around to everyone's pc and set it up manually. Oh well. Thanks for the responses!
Then just change <Computer> to the name of each client, run it from a command prompt, hit the up arrow, change the client name, hit enter, repeat x 50. Much faster.
schtasks /Create /U <DOMAIN\Administrator> /P <Password> /RU <DOMAIN\Account to run task under> /RP <Password> /SC DAILY /TN "Daily Reboot" /TR "shutdown.exe -r -f" /ST 00:00:00 /S <Computer> -
ranjitcool Member Posts: 80 ■■□□□□□□□□lmao i got it..
ok this is what u shud do, assuming u have rights to execute on the 50 systems
the shutdown -r
gives the rpc shutdown/reboot timer of 30 seconds
and after that the system will reboot
i think thats the best solution.
BUT... ok theres always a big BUT.. if u have an admin or some smart user on the system. he can issue shutdown -a to stop it
UNLESS..ok theres a big unless also... if u have a group policy object that does not allow users to issue commands or execute commands in the cmd, he will be power less
i think this will be a perfect solution to u r problem.
now think of a script to type in teh shutdow -r (try it on ur own pc)
if it were in linux, i wud write a shell script /ip/ shutdown -r and so on.. and put it as a cron job to execute every mid night
thanks and hope this helps and no offends about my stupid jokes.. i try to be funny
rjCleared Network+, MCTS.
Want to clear - CCSA, CCNA, VCP for now.
Spending time @ www.itgrunts.com - Tech Juice, Not from Concentrate! -
ranjitcool Member Posts: 80 ■■□□□□□□□□astorrs wrote:the_erickee wrote:We are actually trying to keep it local on each machine. Any other ideas?
oh dear.. i didnt read this that he had already mentioned about this..
oopsy! and now i did , its a pretty good explanation of what was on my mind..
thanks
rjCleared Network+, MCTS.
Want to clear - CCSA, CCNA, VCP for now.
Spending time @ www.itgrunts.com - Tech Juice, Not from Concentrate! -
bjaxx Member Posts: 217ranjitcool wrote:astorrs wrote:the_erickee wrote:We are actually trying to keep it local on each machine. Any other ideas?
oh dear.. i didnt read this that he had already mentioned about this..
oopsy! and now i did , its a pretty good explanation of what was on my mind..
thanks
rj
ranjitcool -
how many redbulls or cups of coffee did you have this am?
Stick with astorrs solution - he's giving it to you on a platter."You have to hate to lose more than you love to win" -
ranjitcool Member Posts: 80 ■■□□□□□□□□had tea with some honey in it, but got that honey from starbucks..
oh wait, cafinated honey.... oh dear!
Cleared Network+, MCTS.
Want to clear - CCSA, CCNA, VCP for now.
Spending time @ www.itgrunts.com - Tech Juice, Not from Concentrate! -
the_erickee Member Posts: 74 ■■□□□□□□□□astorrs wrote:the_erickee wrote:^^ Lol. yeah that might work.
I think we are going to have to just go around to everyone's pc and set it up manually. Oh well. Thanks for the responses!
Then just change <Computer> to the name of each client, run it from a command prompt, hit the up arrow, change the client name, hit enter, repeat x 50. Much faster.
schtasks /Create /U <DOMAIN\Administrator> /P <Password> /RU <DOMAIN\Account to run task under> /RP <Password> /SC DAILY /TN "Daily Reboot" /TR "shutdown.exe -r -f" /ST 00:00:00 /S <Computer>
I did read it but we dont want to place the admin pw in plain text. we are a nonprofit government agency and this script is going on government systems to comply with security agreements. sorry for leaving out so much detail.Erick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+ -
astorrs Member Posts: 3,139 ■■■■■■□□□□the_erickee wrote:I did read it but we dont want to place the admin pw in plain text. we are a nonprofit government agency and this script is going on government systems to comply with security agreements. sorry for leaving out so much detail.
P.S. I would never suggest you leave an unencrypted username/password anywhere, don't worry. -
sprkymrk Member Posts: 4,884 ■■■□□□□□□□astorrs wrote:Then just change <Computer> to the name of each client, run it from a command prompt, hit the up arrow, change the client name, hit enter, repeat x 50. Much faster.
schtasks /Create /U <DOMAIN\Administrator> /P <Password> /RU <DOMAIN\Account to run task under> /RP <Password> /SC DAILY /TN "Daily Reboot" /TR "shutdown.exe -r -f" /ST 00:00:00 /S <Computer>
Or rather than change the <Computer> name and enter the command 50 times, use a "for" loop with a text file of the computer names, or even easier, the IP Addresses. Let's say your IP addresses are 192.168.1.10-50, use this from a cmd prompt:for /L %C in (10,1,50) do schtasks /Create /U <DOMAIN\Administrator> /P <Password> /RU <DOMAIN\Account to run task under> /RP <Password> /SC DAILY /TN "Daily Reboot" /TR "shutdown.exe -r -f" /ST 00:00:00 /S 192.168.1.%C
Type that once and you're done. The numbers in parentheses above (10,1,50) are your start, step, end numbers for the last octet of the ip scheme. Starting at 10, then incrementing by 1 up to 50. If you have an easy way to create a text file fo computer names and want to use that rather than an IP address use something like this:for /F %C in (C:\temp\computernames.txt) do schtasks /Create /U <DOMAIN\Administrator> /P <Password> /RU <DOMAIN\Account to run task under> /RP <Password> /SC DAILY /TN "Daily Reboot" /TR "shutdown.exe -r -f" /ST 00:00:00 /S 192.168.1.%C
All things are possible, only believe. -
undomiel Member Posts: 2,818I was waiting for sprkymrk and his love of the FOR loop to jump in on this.Jumping on the IT blogging band wagon -- http://www.jefferyland.com/
-
the_erickee Member Posts: 74 ■■□□□□□□□□Thanks for the replies again. I will try the above solution. if i was going to make the *.txt file, would i list the computers like this:
PC1
PC2
PC3
or like this:
PC1,PC2,PC3Erick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+ -
undomiel Member Posts: 2,818PC1
PC2
PC3Jumping on the IT blogging band wagon -- http://www.jefferyland.com/ -
astorrs Member Posts: 3,139 ■■■■■■□□□□undomiel wrote:I was waiting for sprkymrk and his love of the FOR loop to jump in on this.
If you want to quickly **** a list of all the computers in your domain to a text file you can use for this (prune it after if there are machines you don't want to include) you could always use another FOR loop to generate it:
for /f "tokens=1,*" %c in ('net view') do @echo %c >> computers.txt -
the_erickee Member Posts: 74 ■■□□□□□□□□IT WORKS!!
Thanks guys. You made my job easy again. lol. This site is amazing. I love it!Erick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+ -
sprkymrk Member Posts: 4,884 ■■■□□□□□□□the_erickee wrote:IT WORKS!!
Thanks guys. You made my job easy again. lol. This site is amazing. I love it!
Great news, and thanks for the update.
To further complicate the issue though (which is always fun) if you want to save the above command as a batch file so you dont have to retype it every time you want to reboot the computers, make sure to use double percent symbols in front of your variables like this:for /F %%C in (C:\temp\computernames.txt) do schtasks /Create /U <DOMAIN\Administrator> /P <Password> /RU <DOMAIN\Account to run task under> /RP <Password> /SC DAILY /TN "Daily Reboot" /TR "shutdown.exe -r -f" /ST 00:00:00 /S 192.168.1.%%C
The "for" command is funny about that. Type it at a cmd prompt, you use single %, save it as a batch file, use double %%.All things are possible, only believe. -
sprkymrk Member Posts: 4,884 ■■■□□□□□□□undomiel wrote:I was waiting for sprkymrk and his love of the FOR loop to jump in on this.
I couldn't resist!
And astorrs made it easy for me; copy, paste, add about 10 seconds worth of editing and *poof* my job was done.All things are possible, only believe. -
BeaverC32 Member Posts: 670 ■■■□□□□□□□Just out of curiosity, what is the reason behind rebooting 50 workstations every night??MCSE 2003, MCSA 2003, LPIC-1, MCP, MCTS: Vista Config, MCTS: SQL Server 2005, CCNA, A+, Network+, Server+, Security+, Linux+, BSCS (Information Systems)
-
the_erickee Member Posts: 74 ■■□□□□□□□□^^
rebooting will prevent small problems most of our users run into. and government is making us. lol :PErick Marshall - @erickbm
MCSE,MCITP x2,vExpert 2015,VCAP,VCP5 x2,MCSA x2,MCTS x3,MCP x2,UCP,Network+,A+