Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

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.

Posted

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.

Posted
prepend the 'start' command to each line. That way the shutdown commands will run in parallel and your script will not get stuck.
Posted
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

 

?

Posted
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.
Posted
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.
Posted

Sure here it is:

 

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...