PDA

View Full Version : need someway to shutdown all desktop machines but not server



nedkelly
13-01-2010, 11:45 AM
Hey my old school has asked me to find a way to turn off all their pcs in the school at 6pm. Was thinking about trying the shutdown command, but there are 50 or so machines and of course they dont want the servers to shut down. Any ideas?

wainuitech
13-01-2010, 11:57 AM
Whats the server and whats the OS's on the workstations ?

Most servers have the ability to shut down PC's connected to them at a set time. Example (http://www.computerperformance.co.uk/w2k3/shutdown.htm)

For Server 2003
shutdown.exe
Use the shutdown.exe command to shut down or restart local or remote computers. You can also use it for shutting down several computers at once using the /i option. With this option, a new window appears where you add the names of the computers that you want to shut down or restart.

nedkelly
13-01-2010, 12:48 PM
server is running windows server 2003 (not sure what version) and all of the windows desktops are running xp pro.

psycik
13-01-2010, 01:43 PM
server is running windows server 2003 (not sure what version) and all of the windows desktops are running xp pro.

So yes the shutdown command will work here. I have a VM server (windows 2003) with a couple of W7 and XP machines on it. I run a shutdown command on the server which shuts down the clients, then shuts the server down.

You just connect to the client machine over the network then issue the shutdown command to the client machine.

SolMiester
13-01-2010, 02:27 PM
You could go to sleepysoftware.com, they have a little app that you can set restart or shutdowns

nedkelly
13-01-2010, 03:42 PM
psycik: need the server to stay on as well as the other ones as well.
SolMiester: I thought there might be a setting in group policy for shutting them down. But will look into that app.

fred_fish
13-01-2010, 04:23 PM
run a batch file on the server with a for loop to shutdown all required machines.
could do it by ip if the servers are distinct

for /l %%a in (10,1,60) do shutdown -f -s -m \\192.168.0.%%a -c "muahahaha"
or by a list of machine names in a text file

for /f %%a in (machinelist.txt) do shutdown -f -s -m \\%%a -c "go home, your dinner is cold"

or drop a scheduled task onto each client to do it themselves.

nedkelly
13-01-2010, 04:46 PM
Yeah a batch file would be easier than going around all the machines and adding a scheduled task. Especially the last method of having the machines in a list, what would be the information in the txt file? Can you give all the pcs a scheduled task through group policy? Shame I did not ask this soon. Just re-imaged the entire school.

wainuitech
13-01-2010, 04:48 PM
Are the PC's & Server in a domain, or just a workgroup ?

nedkelly
13-01-2010, 04:54 PM
They are in a domain. I am very certain that the servers all have statics. But the thing is the school is a mixed environment. No set ranges for macs or pcs.

wainuitech
13-01-2010, 05:01 PM
Have a read of This article (http://maximumpcguides.com/windows-vista/use-the-remote-shutdown-tool-to-shutdown-restart-or-logoff-a-local-or-networked-computer/) - down the botom may be of interect - also found This software (http://www.filebuzz.com/files/Domain_Shutdown/1.html) JOC not free, but I dont have time to try it currently.

fred_fish
13-01-2010, 05:26 PM
what would be the information in the txt file?
just the machine names (yes all of them) one per line eg.

pc1
pc2
pc3
etc.

as for the mac's all bets are off :)

nedkelly
13-01-2010, 05:58 PM
macs are already done. One image for each type of mac with all settings and software installed. And told to shut down at 6pm

nedkelly
13-01-2010, 06:01 PM
So fred_fish do I just copy the code you put into your previous post into a notepad doc and save it with a .bat extension?
Also where would I save the machinelist.txt file?

fred_fish
13-01-2010, 06:30 PM
So fred_fish do I just copy the code you put into your previous post into a notepad doc and save it with a .bat extension?
Yup. Or .cmd

Also where would I save the machinelist.txt file?
Same place as the batch file, or else you need the path to it in the command.

If all your targets are in a DHCP pool that excludes the servers I would lean towards the "for /l" option as it will just cycle through all the IP's.
Saves making (and updating) a target list, and the Mac's will ignore the command anyway.

nedkelly
13-01-2010, 07:01 PM
yeah class b address pool but the servers are in the pool as well so will probably do the name list. And being a school they are all perfectly numbered.

fred_fish
13-01-2010, 07:17 PM
If they are numbered you could still use the for /l option with the placeholder as a substring in the machine name rather than ip.
But it really depends on your naming scheme, and padding may be an issue (although should be easy to work around)

nedkelly
13-01-2010, 07:34 PM
naming scheme: three letters (same for all) then number

fred_fish
14-01-2010, 10:30 AM
for /l %%a in (1,1,9) do shutdown -f -s -m \\abc00%%a
for /l %%a in (10,1,99) do shutdown -f -s -m \\abc0%%a
for /l %%a in (100,1,999) do shutdown -f -s -m \\abc%%a
or combinations thereof :)

nedkelly
14-01-2010, 03:14 PM
hey fred_fish, just wondering what the numbers in the code are for and what do they do?

fred_fish
14-01-2010, 03:28 PM
from for /?

FOR /L %variable IN (start,step,end) DO command [command-parameters]

The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)