+ Post New Thread
Results 1 to 6 of 6
Windows Thread, batch file to shutdown PCs in Technical; has anyone created a batch file to shutdown PCs that could be run as a sheldule task at the end ...
  1. #1
    macca's Avatar
    Join Date
    Dec 2006
    Location
    East Sussex
    Posts
    54
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    batch file to shutdown PCs

    has anyone created a batch file to shutdown PCs that could be run as a sheldule task at the end of the day

  2. #2

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    9,381
    Thank Post
    354
    Thanked 1,350 Times in 928 Posts
    Blog Entries
    4
    Rep Power
    1203

    Re: batch file to shutdown PCs

    We are doing that every night using PSTools and the following command in a .CMD file:

    psshutdown -m "This computer will shutdown in 5 minutes. Please save any unsaved work." -t 300 -f \\stationname.domainname.local

    You can download PSTools from the Sysinternals pages of the Microsoft website.

    Hope this helps.

  3. #3
    Andi's Avatar
    Join Date
    Feb 2007
    Location
    Newport, South Wales
    Posts
    276
    Thank Post
    52
    Thanked 4 Times in 4 Posts
    Rep Power
    16

    Re: batch file to shutdown PCs

    We use a tool called LanViewer which scripts this for you nicely amongst other features. All free too. I believe the link is in the downloads section of this site.

    An example of the script you could run would be:
    "shutdown.exe -s -m \\computername"

    There are other switches you can put in to warn the users, or force a shutdown if someone is logged on etc, but this is what we use nightly with no issues.

  4. #4
    Heebeejeebee's Avatar
    Join Date
    Nov 2006
    Location
    Intergalactic Cruise
    Posts
    1,067
    Thank Post
    69
    Thanked 81 Times in 64 Posts
    Rep Power
    36

    Re: batch file to shutdown PCs

    We're doing it here to but with the usual windows command:

    shutdown -m \\pcname-s -t 60 -c "If you're still here - you shouldn't be, type of message"

    Batch file(s) in the scheduled task set to run at around 9:30pm. We have to leave it that late because of evening classes etc.

    We also run a script that shuts curriculum machines down just after the students are meant to leave (about an hour after school finishes) and the batch file that runs in the evening catches any that have been turned on since then plus admin machines.

    HBJB

  5. #5

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,689
    Thank Post
    756
    Thanked 1,715 Times in 1,526 Posts
    Rep Power
    438

    Re: batch file to shutdown PCs

    If they are xp and you have 2003 server you can use the built in shutdown command.

    Create a text file containing the names of the pc's you wish to shut down.

    Then create a batch file containing:

    Code:
    FOR /F %%f IN (06.txt) DO shutdown -s -f -m \\%%f ] -c "You should have switched me off Dave"
    Ben

  6. #6

    Join Date
    Jan 2007
    Location
    oop north
    Posts
    131
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: batch file to shutdown PCs

    Here's mine. It checks to see which machines are on 1st which reduces the time taken to run. There's a skip list to exlude servers etc...
    Attached Files Attached Files



SHARE:
+ Post New Thread

Similar Threads

  1. Rename a PC from a batch file - Any ideas?
    By MrLudwig in forum Windows
    Replies: 13
    Last Post: 8th December 2007, 03:40 AM
  2. executing a random command in a batch file
    By Halfmad in forum Scripts
    Replies: 12
    Last Post: 6th November 2007, 10:25 PM
  3. Shutdown batch script stalls if 1 PC is shut down
    By PrimaryTech in forum Scripts
    Replies: 8
    Last Post: 7th July 2007, 07:04 PM
  4. prezzie batch file to collect dps logs
    By russdev in forum ICT KS3 SATS Tests
    Replies: 4
    Last Post: 16th May 2006, 01:16 PM
  5. batch file help
    By beeswax in forum Scripts
    Replies: 9
    Last Post: 3rd March 2006, 08:48 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •