+ Post New Thread
Results 1 to 11 of 11
How do you do....it? Thread, Remote Shutdown Query in Technical; I have a batch file that shutdowns down a whole room, with a mesage and a timer this works fine, ...
  1. #1

    Join Date
    Feb 2007
    Location
    Lincolnshire
    Posts
    120
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Remote Shutdown Query

    I have a batch file that shutdowns down a whole room, with a mesage and a timer this works fine, the problem is if one or two of the pcs in the room are already off it seems to take a long while to go onto the next machine is there anyway of telling it to only wait a set period of time before it moves onto the next pc ?

    For example:

    Shutdown -s -m \\PCName -t 100
    'Some command here to check if the next pc is on?
    Shutdown -s -m \\PCName -t 100
    Shutdown -s -m \\PCName -t 100

    Any help would be appreciated.

  2. #2
    Busybub's Avatar
    Join Date
    Feb 2007
    Posts
    384
    Thank Post
    44
    Thanked 39 Times in 37 Posts
    Rep Power
    22

    Re: Remote Shutdown Query

    Try it all on one line:

    Shutdown -s -m \\PCName -t 100 | Shutdown -s -m \\PCName -t 100 | etc

    I have this working in a room of 30 and it shuts them all down at the same time, doesn't make any difference if some of them are already off.

  3. #3

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Remote Shutdown Query

    prepend the 'start' command to each line. That way the shutdown commands will run in parallel and your script will not get stuck.

  4. #4

    Join Date
    Feb 2007
    Location
    Lincolnshire
    Posts
    120
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Remote Shutdown Query

    Quote Originally Posted by Geoff
    prepend the 'start' command to each line. That way the shutdown commands will run in parallel and your script will not get stuck.
    Hi could you give me an example did you mean

    Start Shutdown -s -m \\pcname -t 100

    ?

  5. #5

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Remote Shutdown Query

    yes, that's correct.

  6. #6
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    42

    Re: Remote Shutdown Query

    May be OTT but i use a vbscript to read compy names from a csv file and send a shutdown command to each on in the list. As its done this way, the shutdown command is in a separate windows shell so even if one hags the others are unaffected and i need only update the csv file if anything changes, not the script.

  7. #7

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,811
    Thank Post
    3,327
    Thanked 1,056 Times in 977 Posts
    Rep Power
    365

    Re: Remote Shutdown Query

    apeo

    Any chance I can get a copy of that script or post it on here or something

    thanks

  8. #8
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,488
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76

    Re: Remote Shutdown Query

    How about creating a batch file per PC and then having your scheduled task call all those batch files? The schedule will run pc1.bat and then immediately go on to pc2.bat regardless of whether or not pc1 ever responded.

  9. #9
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    42

    Re: Remote Shutdown Query

    Sure here it is:

    Code:
    Dim objFSO, ObjTextFile
    Dim CurLine, arrCurRecord
    Dim strCompName
    Dim WshShell
    
    on error resume next
    
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile("d:\shutdown\complist.csv", 1)
    
    While objTextFile.atendofstream <> True 'Keep going until the end of the file
    	CurLine=objTextFile.readline 'Read the current line
    	arrCurRecord=split(CurLine,",") 'Split the line into records at every ","
    	strCompName=arrCurRecord(0)
    	'send shutdown command
    	wshShell.run "c:\windows\system32\shutdown.exe -s -f -m \\" & strCompName
    Wend 'do while objTextFile.atendofstream <> true
    
    'clean up
    Set objTextFile = Nothing
    Set objFSO = Nothing
    Set WshShell = Nothing
    Ok having looked at my current one, i decided to make a few changes and this is what it looks like now. The csv file only contains a list of computer names but you could have other info in there if you wish so long as the first column is the computer name this should still work.

  10. #10

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124

    Re: Remote Shutdown Query

    On the basis that it's always good to have multiple ways of doing the same thing, my version is at http://techinfo.cnwl.ac.uk/Windows%2...0computers.htm

    Instead of reading a fixed list of computers, it tries to find out which ones are switched on. It pings them to make sure they are on and then shuts them down.

  11. #11
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    42

    Re: Remote Shutdown Query

    Funny I have code that pings compy but i use it for something else.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 8
    Last Post: 5th April 2009, 08:57 AM
  2. Disabling the remote shutdown command.
    By IT_Man_Dan in forum Windows
    Replies: 15
    Last Post: 15th November 2007, 01:31 PM
  3. Query of existing query data in PHP
    By markwilliamson2001 in forum Web Development
    Replies: 5
    Last Post: 5th October 2007, 08:43 AM
  4. Remote shutdown
    By Kained in forum Windows
    Replies: 9
    Last Post: 28th August 2007, 06:44 PM
  5. Remote PC shutdown tools - AD and Time sync
    By sycho666 in forum Windows
    Replies: 1
    Last Post: 20th April 2007, 08:25 AM

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
  •