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
Solved

Shutdown Script for Active Directory - Domian Group Policy

Posted on 2007-04-10
4
3,836 Views
Last Modified: 2009-04-28
Our company is using windows 2003 server and active directory. I need to create a script that shuts down all our computers except for the server at 8PM every night.  I would like to apply this a group policy for the domain. What is the best way to do this and what script should I use. .I should add I have no skills in writing scripts. Thank you in advance.
0
Comment
Question by:surf4evr
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 125 total points
ID: 18883541
Have a list of computers?  This will do it..

For /f %%a in (C:\Computers.txt) do schtasks /s %%a /create /ru system /sc daily /st 20:00:00 /tn Shutdown /tr "shutdown -s -f -t 10"

It'll loop through all systems setting up a scheduled task to shut them down at 8pm
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21197821
Forced accept.

Computer101
EE Admin
0
 
LVL 3

Expert Comment

by:durge
ID: 24253079
I've turned this into an easily editable batch script, the source code is here. If you wish to comment on where I originally posted this, here is the link.

http://bbs.dontassrape.us/viewtopic.php?id=295
@echo off
REM Variables - CHANGE THESE TO SUIT YOUR NEEDS
 
REM The list of computers that will be read, one line per computer in the text file!
Set ListFile=ITsuitePClist.txt
 
REM The name of the log file to write to.
Set LogFile=deploylog.txt
 
REM The shutdown time, must be 24 hours in the same format as below.
Set ShutdownAt=18:30:00
 
REM The shutdown timeout, how long the computer waits before it shuts down.
Set ShutdownTimeOut=10
 
REM The name of the task, this will appear in Scheduled Tasks on the workstations, a good idea not to use spaces.
Set TaskName=EveShutdown
 
 
REM Dont touch below ;)
 
title Network Shutdown Deploy - Stage 1 (using list file: %ListFile%)
echo.
echo.About to deploy shutdown scheduled task, using file %ListFile%
echo.
echo.Press any key to review the computers being deployed to...
pause >nul
title Network Shutdown Deploy - Stage 2 (using list file: %ListFile%)
echo.Contents of list file:
echo.
echo.START OF LIST
echo.
type %ListFile% |more
echo.
echo.END OF LIST
echo.
echo.Press any key to begin the deploy (CTRL+C to abort now)...
pause >nul
title Network Shutdown Deploy - Stage 3 (using list file: %ListFile%)
echo.
echo.Deploying, See %LogFile% for deploy messages.
echo.
echo.(if you dont see any activity it probably means the task already exists, Press Y to replace the task continually, you will eventually get to the Complete stage)
echo.
echo. >> %LogFile%
echo.BEGIN - Shutdown Deploy Log For %time% - %date% >> %LogFile%
echo. >> %LogFile%
For /f %%a in (%ListFile%) do schtasks /s %%a /create /ru system /sc daily /st %ShutdownAt% /tn %TaskName% /tr "shutdown -s -f -t %ShutdownTimeOut%" >> %LogFile%
echo. >> %LogFile%
echo.END - Shutdown Deploy Log For %time% - %date% >> %LogFile%
title Network Shutdown Deploy - Stage 4 - COMPLETE! (using list file: %ListFile%)
echo.
echo.Complete, See %LogFile% for deploy messages.
echo.
echo.Press any key to exit.
pause >nul
exit

Open in new window

0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Event ID: 5719 / Source: NETLOGON 9 146
Anti-virus for Linux Server 15 155
hp mini 3 67
reboot server with scheduled time and week base 4 35
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

828 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