How to to shut dows the network PCs automatically through task scheduler\through batch file

Hi  

We have windows 2012 DC and windows 7 PC . I want to shut down the PC in our organisation @ 7PM. Is there a way of setting up this through our  Domain Controller task scheduler or through GPO with batch file.

We have 4  OUs
ITOU1,ITOU2,ITOU3,ITOU4, and each IT rooms have 40 PC.
Please suggest any tutorials would be great

Thanks





Any tutorials much appreciated

Do I need to do through  I am in a process of choosing a Network PC shutdown software. Meanwhile

 I want to run a batch file from my windows 7 PC , so that it can shutdown the chosen network PCs.

 If the script cant find the PC It should ignore that PC and shut down the remaining alive PCs.Plaese post me the syntax to do this.

 Any help will be grateful.

 Many thanks
lianne143Asked:
Who is Participating?
 
Matt DDomain ArchitectCommented:
Network Shutdown Tips

for /f %%i in (list-of-computers.txt) do (
shutdown.exe /s /f /m \\%%i /t 60 /c "regular shutdown"

Open in new window

0
 
MHMAdminsCommented:
I would use a Group policy if you're in a domain setting to change power settings to turn them off.

Managing Power with Group Policy: Part 2 of 3

http://blogs.technet.com/b/askds/archive/2008/03/19/managing-power-with-group-policy-part-2-or-3.aspx

Standby Explained (S1, S3)

http://blogs.msdn.com/b/omars/archive/2004/05/11/129553.aspx

In addition, Group Policy Preference should be also a good choise:

Configuring a Power Plan with Group Policy Preferences (by Alan Burchill)

http://blogs.technet.com/b/grouppolicy/archive/2009/09/30/configuring-a-power-plan-with-group-policy-preferences-by-alan-burchill.aspx
0
 
Randy PooleCommented:
You may want to look at psshutdown which can do what you want plus quite a bit more.  You can download it as part of the Windows Sysinternals PsTools package here:
http://technet.microsoft.com/en-us/sysinternals/bb897541
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
lianne143Author Commented:
Thanks  for the script ,

for /f %%i in (list-of-computers.txt) do (
shutdown.exe /s /f /m \\%%i /t 60 /c "regular shutdown"

 How do i make it work and where do i copy this script for the network PCs to shutdown
0
 
Matt DDomain ArchitectCommented:
It's a batch script.  Open notepad and copy and paste that text into it, name it NetShutdown.BAT or similar.

Open another blank notepad file, and populate your list of workstations, one on each line.  Save it as "list-of-computers.txt" (if you use a different name, change it in the batch file as well).

As long as both files are in the same folder, you should be able to run that from anywhere on your network.  It will use your current credentials to execute the shutdown.
0
 
lianne143Author Commented:
Using these batch files, Is it possible to automate the shutdown process every day.
0
 
Matt DDomain ArchitectCommented:
Sure.  You can execute the script with Scheduled Tasks.

Easier method though if you want this nightly and on a set of computers may be to configure the Shut Down Task in Group Policy Preferences, then assign that policy to an AD group containing those workstations.

Group Policy: Configure a Scheduled Task Item

Set the "Task Trigger" frequency  on "daily", enter the date and time you want your PC to shutdown. On the "Action" screen, choose "Start a program".  

In the "Program/script" text field, type C:\Windows\System32\shutdown.exe

In the Add arguments text field type /s.

Click "Next" and click "Finish."
0
 
lianne143Author Commented:
Hi Matt

I created two files one as .bat and other as text and i copied to a folder on my desktop executed the batch file and the 2 network PC didnt shut down.
Please see the attached and let me know if i am making a mistake.

Thanks
List-of-computer.txt
Shutdown.txt
0
 
lianne143Author Commented:
Guys please help if I am doing mistake in the scripts
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You need a closing paren at the very end of the batch file - this is missing in the original suggestion http:#a40304553 already.

You do not need the computer file, if you would rather have it in the batch file all at once:
for /f %%i in (List-of-computer.txt) do (
  start "%%i" shutdown.exe /s /f /m \\%%i /t 60 /c "regular shutdown"
)

Open in new window

I've also added the start command to run the shutdowns simultanously (non-waiting). This comes in handy particularly if machines are not reachable, as the script will not wait until a timeout is triggered before proceeding with the next machine.
0
 
lianne143Author Commented:
Will I be able  to add  a message in the script  stating " This PC will shut down in 2 Minutes , please save your work immediately"  
Please suggest
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You can put that into the batch instead of "regular shutdown". But two minutes is not correct, we allow for 1 minute only (/t 60) ;-).
0
 
lianne143Author Commented:
I have created this batch file, How do I test this locally on one PC before I configure in the group policy scheduled task.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Only have your PC in your text file of computers, and change the grace period to something greater (e.g. 300 seconds = 5 minutes) so you can abort the shutdown.
0
 
LeeTutorretiredCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Objecting to deletion. The OP was following the advice given, only the final confirmation is missing. Based on the conversation, and the solution being working in general, the following split seems to be appropriate:
http:#a40304553  300
http:#a40305348  100
http:#a40385607  100
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.