Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-09-04
17
Medium Priority
?
239 Views
Last Modified: 2014-12-15
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
0
Comment
Question by:lianne143
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +3
17 Comments
 
LVL 9

Expert Comment

by:MHMAdmins
ID: 40304490
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
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40304551
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
 
LVL 3

Accepted Solution

by:
Matt D earned 1600 total points
ID: 40304553
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:lianne143
ID: 40304711
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
 
LVL 3

Expert Comment

by:Matt D
ID: 40305281
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
 

Author Comment

by:lianne143
ID: 40305294
Using these batch files, Is it possible to automate the shutdown process every day.
0
 
LVL 3

Assisted Solution

by:Matt D
Matt D earned 1600 total points
ID: 40305348
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
 

Author Comment

by:lianne143
ID: 40332922
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
 

Author Comment

by:lianne143
ID: 40340364
Guys please help if I am doing mistake in the scripts
0
 
LVL 71

Assisted Solution

by:Qlemo
Qlemo earned 400 total points
ID: 40385607
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
 

Author Comment

by:lianne143
ID: 40418984
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
 
LVL 71

Expert Comment

by:Qlemo
ID: 40420074
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
 

Author Comment

by:lianne143
ID: 40449442
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
 
LVL 71

Expert Comment

by:Qlemo
ID: 40449500
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
 
LVL 59

Expert Comment

by:LeeTutor
ID: 40498392
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 40498393
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A hard and fast method for reducing Active Directory Administrators members.
Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question