1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Windows Shutdown multiple PC's with batch file

Discussion in 'Software' started by unknowngamer, 3 Oct 2011.

  1. unknowngamer

    unknowngamer here

    Joined:
    3 Apr 2009
    Posts:
    1,200
    Likes Received:
    98
    I'm runnning at half capacity today, my memory is stuffed....

    Anyway, my task is simple.

    I want to shut down 9 PC's at 4.30 every day.

    I'm running windows server 2003 and the clients are on a domain runnning xp.

    I was going to just put a simple batch file as a scheduled task. using: shutdown -s -t 60
    but I can't remember if it would work if there was no one logged on (memory is really gone today)

    or am I best running a script from the server like this

    What I want is relabilty over neatness of code or simplicty of implementation.

    I just want 9 PC's of every day at 4.30 with out fail.

    It's getting on my tits seeing 9 PC's that have been runing over the whole weekend 'cos some silly $*&£ can't bothered to shut down.
     
  2. GregTheRotter

    GregTheRotter Minimodder

    Joined:
    9 Aug 2008
    Posts:
    4,272
    Likes Received:
    88
    Silly question; can't you just set the pc's to shutdown after x amount of time being idle? If not, why not??
     
  3. unknowngamer

    unknowngamer here

    Joined:
    3 Apr 2009
    Posts:
    1,200
    Likes Received:
    98
    I don't mind them being on during the day, it can take a while to boot up, so it get the users on faster. Plus some times folks might get called away mid-job, to come back to find thier work gone. At 4.30 we shut, if they've not saved thier work before going home it's their own F&@^ing fault.
     
  4. Krikkit

    Krikkit All glory to the hypnotoad! Super Moderator

    Joined:
    21 Jan 2003
    Posts:
    23,588
    Likes Received:
    419
    Why don't you just have a popup to remind people to shut down their computer at 4:20? That way it can be ignored if they have work which needs to be left open/unsaved for a while.
     
  5. unknowngamer

    unknowngamer here

    Joined:
    3 Apr 2009
    Posts:
    1,200
    Likes Received:
    98
    Most of the people are finnished by 4pm, some may stay until 4.30.

    The computer use can be a bit random, some time they'll all be used until 4.00, some time they won't be used all afternoon but still left on.


    Thanks for the sugestions folks, but the shutdown script is probably the best option.
    Just want the best oprtion.

    I suppose I could do both, it's only 9 pc's...
     
  6. GregTheRotter

    GregTheRotter Minimodder

    Joined:
    9 Aug 2008
    Posts:
    4,272
    Likes Received:
    88
    Ok, why not just have it go onto standby, if they leave the pc? That way they don't lose their work, and you aren't running up the leccy bill?
     
  7. Zoon

    Zoon Hunting Wabbits since the 80s

    Joined:
    12 Mar 2001
    Posts:
    5,520
    Likes Received:
    640
    The hibernate option is probably the best idea. Standby after 15 minutes idle, hibernate after 1 hour.

    This way even during the working day you'll be saving power for those idle PCs that sit there, and equally you're not going to have to maintain a batch script (which will fail now and then for inexplicable reasons) or risk losing work / corrupting files.

    If you hibernate them via the Power Saving options, which you can force via Active Directory policy, its all in one place, applied to everything, and off you go!

    If you don't have AD, you can use gpedit.msc on each local machine instead.
     
  8. sparkyboy22

    sparkyboy22 Web Tinkerer

    Joined:
    3 May 2010
    Posts:
    738
    Likes Received:
    35
    Im not sure if the batch file will work if no one is logged onto the server as the user running the batch file has to have admin rights on each of the pc's you want to shutdown. If i remember right you need to use /m "machine name".

    Why not set a scheduled task on the machines.
     
  9. Fantus

    Fantus Nothing to see here...

    Joined:
    25 Jun 2010
    Posts:
    696
    Likes Received:
    41
    You should be able to do it through Group Policy. It's one of the other guys I work with who set it up so I couldn't tell you exactly but you can set it as a scheduled task at startup.
    We do exactly the same thing and have all PC's turn off except a specific few, saves A LOT of money on the sites electricity bill across a year.
     
  10. thehippoz

    thehippoz What's a Dremel?

    Joined:
    19 Dec 2008
    Posts:
    5,780
    Likes Received:
    174
    can do this with the task scheduler in xp

    http://www.winxptutor.com/schsd.htm

    zoons idea with hibernate sounds good too..
     
  11. Pookeyhead

    Pookeyhead It's big, and it's clever.

    Joined:
    30 Jan 2004
    Posts:
    10,937
    Likes Received:
    536
    Why not just set a scheduled event to shut down at 4:30 on each PC?
     
  12. Landy_Ed

    Landy_Ed Combat Novice

    Joined:
    6 May 2009
    Posts:
    1,428
    Likes Received:
    39
    powershell no use to you? sure gives a lot more control than dos batch
     
  13. Jasio

    Jasio Made in Canada

    Joined:
    27 Jun 2008
    Posts:
    810
    Likes Received:
    13
    Very long extension cords and everything plugged into one socket.

    Problem solved. :p
     
  14. thehippoz

    thehippoz What's a Dremel?

    Joined:
    19 Dec 2008
    Posts:
    5,780
    Likes Received:
    174
    you could even make a little vbs script like this to popup a warning box

    Code:
    Set objArgs = WScript.Arguments
    messageText = objArgs(0)
    MsgBox messageText
    
    then call msg.vbs with the scheduler like 10 minutes before 4:30 with parameters "Warning.. you have 10 minutes before automatic shutdown. Please save your work!"

    :p think xp even has msg.exe.. could do msg * "Warning..."
     
  15. gerardmcmanus

    gerardmcmanus What's a Dremel?

    Joined:
    11 Oct 2011
    Posts:
    25
    Likes Received:
    1
    yeah I would just do this with task manager,

    create a .bat file with:

    shutdown /s

    put it on the server and execute it with task manager on each machine at 4:30

    or use..

    shutdown /s /m \\machine1Name
    shutdown /s /m \\machine2Name

    to shutdown remote pcs with one bat file and excute it with task manager off the one machine.
     
  16. Sav_P20

    Sav_P20 What's a Dremel?

    Joined:
    17 Oct 2011
    Posts:
    4
    Likes Received:
    0
    Hi all

    I was wondering if you can assist?
    I want to be able to create a batch file where it will allow me to do the following:

    Shutdown all PCs on the network
    At certain time of the day such as at 11:30pm at night.

    If I create a text document in notepad and import all the PCs how can I add this to the batch file?

    Many thanks
     
  17. gerardmcmanus

    gerardmcmanus What's a Dremel?

    Joined:
    11 Oct 2011
    Posts:
    25
    Likes Received:
    1
    To simplify if you have one machine you want to shutdown at 11.30.

    1. Open notepad
    2. write "shutdown /s"
    3. go to save and change safe file as to 'any file *.*'
    4. Then call it shutdown.bat
    5. Click start menu - go to search and type "task scheduler"
    6. Click new task, and add a trigger for the time, and action to run the batch file.

    Repeat the process on each machine

    you can do it remotely for other machines, but you then have to deal with access permissions etc., so this is probably the simplest.
     
  18. Sav_P20

    Sav_P20 What's a Dremel?

    Joined:
    17 Oct 2011
    Posts:
    4
    Likes Received:
    0
    Thanks for the tip Gerardmcmanus this does seem a lot easy to do however, I have roughly 250 machines in the office and I was hoping to perform this remotely.

    What I was hoping to do was log on to the server where are PCs are stored. Copy the text file with the list of PCs on the server create a batch to incorproate with the text file.

    Any ideas?

    Thanks
     
  19. gerardmcmanus

    gerardmcmanus What's a Dremel?

    Joined:
    11 Oct 2011
    Posts:
    25
    Likes Received:
    1
    if you create a .bat file with...

    shutdown -m \\machineName -s

    then the same for the other various machines on the network, you can shut them all down, then just run that bat file from the taskmanager on the one machine.

    The problem is you can at times get "Acess is denied. (5)." and to correct this you have to go into the policies for each machine, which would take longer than just adjusting the task manager on each machine.
     
  20. Sav_P20

    Sav_P20 What's a Dremel?

    Joined:
    17 Oct 2011
    Posts:
    4
    Likes Received:
    0
    Thank you very much for that gerardmcmanus this works wonders mate :)...

    I am facing another different issue...

    Basically we have a secure printer in place on a particular server.

    I type in he name of the server and double click the printer to install, which works well for some users...

    For the users that doesnt install i get the following error:

    "A policy is in effect on your computer which prevents you from connecting to this print queue. Please contact your administrator."

    What I am having to do is log in as local admin give the user admin rights, which installs the printer then remove the admin rights on the PC.

    Is there a script that I can run which will prevent me from logging in as local admin to give admin rights on the PC each time?

    Thanks

    Sav
     

Share This Page