1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Need an auto Shutdown Procedure

Discussion in 'Windows XP' started by Eric Hoffy, 2004/11/21.

Thread Status:
Not open for further replies.
  1. 2004/11/21
    Eric Hoffy

    Eric Hoffy Inactive Thread Starter

    Joined:
    2004/11/07
    Messages:
    28
    Likes Received:
    0
    Hi there

    What im looking to do is shutdown or restart the computer everyday at
    10:00 PM
    (Ahh no more argueing with the kids....)
    Which then I have a password bios that wont let the computer boot until the password is entered. (and disable access to other users in task manager to the event so those sneaky clever little boys cant change it! :) )

    So anyways what i have tried so far is to use the task schedular to run shutdown.exe. I used the switches -r -s -f.
    Each time it comes to 10:00 the computer just stays on :confused: :confused:
    I tried making a batch file, with switchs within that, as well and then using the batch file with task schedular. The task schedular wont run it :confused:
    If i run my batch file my computer restarts so i know it works.
    Can anyone give me some ideas as to what im doing wrong
    Thanks in advance :)
    \
    Also
    If anyone knows a way to wait for a certain time in a batch file and then execute a command i would like to learn it.

    something like for pure example im no programmer :rolleyes:

    if time = 10:00pm then start %windir%\System32\shutdown.exe -r


    Bear with me, God isnt finished with me yet
     
  2. 2004/11/21
    Zander

    Zander Geek Member Alumni

    Joined:
    2002/01/07
    Messages:
    4,084
    Likes Received:
    5
    Do you have a password set for logging into windows? If not, you need to create a password for the account you're logging onto. The task scheduler won't do what it's supposed to unless you log on with a password. If you don't want to always have to enter the password when logging on you can use Tweak UI to accomplish this. The key is to have a password set.
     

  3. to hide this advert.

  4. 2004/11/21
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    A couple more things that can easily bite you with scheduled tasks.

    - Task Scheduler service must be running so setting it to autostart is a good idea.

    - Remote Procedure Call (RPC) service must be running for Task Scheduler to work.

    Settings including the user account they run under should be like the picture below.
     
    Newt,
    #3
  5. 2004/11/21
    Eric Hoffy

    Eric Hoffy Inactive Thread Starter

    Joined:
    2004/11/07
    Messages:
    28
    Likes Received:
    0
    Thanks for the replys

    Turns out i disabled the service a while back and forgot about it.
    Works like a charm now. :)

    Any information regarding the batch file would be greatly appreciated. Or any information regarding creating batch files. My new idea is to loop the batch file to check the time every 5 minutes and once the time is greater then 10:00 it would start the shutdown procedure, just incase those clever little boys jump threw the first hoop.
    Does anyone know what language batch files are created with? Basic?
     
  6. 2004/11/22
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Does anyone know what language batch files are created with? Basic?

    Nope. English and notepad works fine as long as you name the file something.bat so for instance, c:\shutdown.bat would do fine.

    If you set the scheduler to run that file at a certain time, no other checking should be needed.

    Make sure you have the item set to run from an account that has admin rights to the PC and if you are worried about mini-hackers at your house (as kids will try to be) you probably want to put shutdown.bat some place less obvious than c:\

    You say you have a batch file that works fine if you run it directly so use that one and just set it up in the scheduler.

    If you have security set on the task, your kids can't mess with it unless they are very clever. In that case, post back with the exact OS version you run and we'll foil them.
     
    Newt,
    #5
  7. 2004/11/22
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,068
    Likes Received:
    396
  8. 2004/11/23
    jp0001uk

    jp0001uk Inactive

    Joined:
    2004/11/23
    Messages:
    3
    Likes Received:
    0
    Hi

    You can download a program from www.download.com called switch off that will let you do all types of stuff (re-boot, disconnect from the internet, and switch off).

    Hope this helps


    John
     
  9. 2004/11/23
    Eric Hoffy

    Eric Hoffy Inactive Thread Starter

    Joined:
    2004/11/07
    Messages:
    28
    Likes Received:
    0
    Thanks for the replys,
    So far the kids havent figured out how the computer shuts off.
    (Those little devils :rolleyes: )
    What i have now works great, im checking out psshutdown right now, Maybe ill upgrade :)

    I would still like to get more information on bat files, Dont ask why thats just the way i am, not satisified till i understand how it all works ;) .
    I found a few websites that are not bad but not quite what im looking for.
    If anyone else is interested in bat files here are the links
    http://www.allenware.com/icsw/icswidx.htm
    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx
    http://www.execnet.com/index.html?page=/filelibs/l253p001.html

    Thanks again for the replys
    I just had a Geirsterblitz what if my kids turn of my computer at 9:58? Then back on at 10:02. The shutdown would not run again eh?:eek: They would have to clear the cmos memory to bypass my bios password at startup, but if they put there minds together i wouldnt be suprised if they did it. :rolleyes: This is why i want a batch file, to keep running a loop of finding the time and execute my shutdown at anytime greater then 10:00. With a possible delay so i can shut it down before it does its job, and of course to load in the config file of windows.
    P.S. Basic is an old Computer language that the program Qbasic used in the old DOS days (thank god we are in gnu's now :D), which looks alot like todays batch files. Not sure however if they are the same. been so long since i did anything with programming :eek: . Now its all C++, javascript, Html, etc..
    Ill stop rambling now before i take up your whole forums. ;)
     
  10. 2004/11/23
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    I just had a Geirsterblitz what if my kids turn of my computer at 9:58? Then back on at 10:02.

    Then we show you how to absolutely lock down the PC so you can use it but they can't and you give them a couple of 'no PC' weeks to contemplate the error of their ways.

    Whooo boy - hearing BASIC described as 'an old computer language' makes me feel really ancient.

    A Batch file can be considered as a program since all Windows systems will look for .exe, .com, .bat file endings and try to execute them.

    Batch files are similar to interpreted BASIC in that they don't need to be compiled (can't be, in fact) and the contents are simply executed sequentially by the OS. They are simply written in something closer to English than other languages are. Intended to allow the PC to execute a series of instructions and then quit rather than to put together a 'program' designed to do something. They make use of calls that are pretty much built into the OS.

    OK - I know the above is oversimplified and not 100% accurate but we got lots of non-programmers reading these threads and I wanted to avoid putting any of them to sleep. :)
     
    Newt,
    #9
  11. 2004/11/23
    Eric Hoffy

    Eric Hoffy Inactive Thread Starter

    Joined:
    2004/11/07
    Messages:
    28
    Likes Received:
    0
    Thanks for the information Newt,
    My problem is im away from home for weeks at a time, and my wife is unable to "control" the boys computer habits. So i decided to take action. I dont feel taking the computer away will be required. There are other factors that play major roles in my decision but i do not wish to discuss them here. I will try the shutdown and if i hear any more problems with the computer i will take further action.
    Newt do you know where i can find a list of these calls.
    Thanks again, Eric :)
     
  12. 2004/11/23
    Zander

    Zander Geek Member Alumni

    Joined:
    2002/01/07
    Messages:
    4,084
    Likes Received:
    5
    Do a search at Google using the words batch file commands. You'll get more pages than you'll ever care to look at. Here's and example of one of them.

    Information on batch files
     
  13. 2004/11/23
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Eric - one thing that will help is to make sure everyone using the PC has an account and that all accounts are password protected.

    Then if you are running XP-home, log on to the administrator account in safe mode. With XP-pro you can do it from normal mode but also will need to be using an administrator account.

    Right-click the My Computer icon, left-click Manage, open the Local Users and Groups section and the Users section.

    Right-click on one of their accounts and left-click on the Members Of tab.

    Remove all groups listed there except Users (or Guests if you really want to limit them). Users will make it possible for them to log on and run many of the programs but not to install anything and not to do other things that can alter the system settings of the PC. Guests will limit them even more.

    As long as they don't know the password for an account with more rights, they can't undo what you have done.

    FWIW, I traveled quite a bit when all nine of my offspring were at home so I fully sympathize. :eek:
     
  14. 2004/11/23
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,068
    Likes Received:
    396
  15. 2004/11/23
    surferdude2

    surferdude2 Inactive

    Joined:
    2004/07/04
    Messages:
    4,009
    Likes Received:
    23
    Eric, I think you could use the XP command AT to great advantage in your situation.

    To find out all about it, create a new Desktop Shortcut and paste the following target line in when asked:

    %windir%\hh.exe ms-its:C:\WINDOWS\Help\ntcmds.chm::/ntcmds.htm

    Name it anything you want but I suggest Command line help.

    Then run that Shortcut and browse to the AT command and see if you think you can use it to call your shutdown batch at some time of your liking.
     
  16. 2004/11/23
    surferdude2

    surferdude2 Inactive

    Joined:
    2004/07/04
    Messages:
    4,009
    Likes Received:
    23
    Here is one way that I have used the AT command:

    at 22:00 "C:\Documents and Settings\Owner\My Documents\Donfiles\Batches\BACKUP2.BAT "

    That runs my backup each night at 10 PM unattended. Executing that command places the schedule in the Registry where it would be hard for a novice to find. The operation you schedule takes place in the background and is hard to detect and harder to stop. About the only way is to use the Task manager to eliminate the running process since it won't show up anywhere else other than a flicker of the HD light. :)

    You could use the command:

    at 22:00 %windir%\System32\shutdown.exe -s

    That will shut the kids down at 10 pm. Change it to fit your needs.

    at 22:00 /every:M,T,W,Th,F,S,Su %windir%\System32\shutdown.exe -s

    That will set you up forever until deleted. To delete type at /delete at a command prompt. That deletes ALL scheduled tasks. You can delete individual tasks also by the proper command.

    The shutdown command and its switches is listed in the Command Line Help. It has a -t switch that allows up to a 99 second warning screen before closing. You can also use the proper switch commands to have it execute every day of the week or skip any that you choose. Very versatile.

    There are many variations you can create with these commands so play around with it and enjoy as you learn. Post back if you have ??

    BTW, you must have the Task Scheduler service running to use the AT command.
     
    Last edited: 2004/11/24
  17. 2004/11/24
    Eric Hoffy

    Eric Hoffy Inactive Thread Starter

    Joined:
    2004/11/07
    Messages:
    28
    Likes Received:
    0
    Thank you all for posting
    I have to leave for work tonight so i will be unable to post back here for quite some time. However im quite sure with all the information i got here that i was able to solve the problem at hand. I will post back when i get back and let you all know if they figured out a way to get around it.
    Thanks again to all at BBS, keep up the good work :)
     
  18. 2004/11/26
    Johanna

    Johanna Inactive Alumni

    Joined:
    2003/03/08
    Messages:
    2,402
    Likes Received:
    2
    From Doug Knox:
    How do I restrict a User's Logon hours?

    You can only restrict when a user can log on to the system. On a stand alone computer, there is no way, currently, to force a user to log off when their hours expire.

    1) Open Help and Support and type "logon hours" (without the quotes) in the search box.
    2) Go to Full text matches and click on "Net user ". See the examples for setting a user's logon hours. Some examples would be:

    net user johnsw /time:M-F,08:00-17:00
    net user johnsw /time:M-F,8am-5pm
    net user marysl /time:M,4am-5pm;T,1pm-3pm;W-F,8:00-17:00
    net user johnsw /time:all (this one means this user can always log on)

    3) Open a Command Prompt window.
    4) Enter the appropriate "net user" command for the user(s) you wish to restrict access for.

    HTH
    Johanna
     
  19. 2004/11/28
    surferdude2

    surferdude2 Inactive

    Joined:
    2004/07/04
    Messages:
    4,009
    Likes Received:
    23
    So...entering the following two commands at a command session would set johnsw for 8 am to 10 pm permitted use:

    net user johnsw /time:M,T,W,Th,F,S,Su 08:00-21:45

    AT 22:00 /every:M,T,W,Th,F,S,Su %windir%\System32\shutdown.exe -s

    All other users would also be shut down but they could restart the system and log back on.

    As Johanna suggests, you could enter different log on restrictions for other identities as needed.

    I think this fits your requirements as best it can be done. You must be certain that you restrict access to the C:\Windows\Tasks folder or they can dump your schedules.
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.