Jump to content

Recommended Posts

Posted

HI,

 

I'm looking for a script that can be run on a server every 5,6,7,8,9 pm that can run a user interruptable shutdown command to all our PC's

 

At the moment I have a simple .bat file that'll live on the server that runs the following command for every PC:

 

shutdown -s -m \\computername1 -t 30 -c "Shutdown in X"

shutdown -s -m \\computername2 -t 30 -c "Shutdown in X"

shutdown -s -m \\computername3 -t 30 -c "Shutdown in X"

and so on.

 

It's working great, except that it's not sending users the warning.

 

Does anyone have any ideas? Both for resolving the issue and for expanding on the scripts functionality.

Posted

If you have a bit of money to spend, I'd suggest getting this:

Remote Shutdown - Automatic Shutdown and WOL Software

 

It's what we use to manage our shutdowns and startups here, machines can be scheduled, shutdowns are easily cancelable if that's what you want and the warning times and messages can be customised. @jonawd recommended this in a similar post to this and it's one of the better pieces of software of its type that I've seen.

  • Thanks 1
Posted

At this point I'm almost 100% sure there's no money available.

We used to have a working GPO that did it but sadly this was killed off by Microsoft in an update.

Which is why I'm aiming more for a script

Posted

A similar concept to you but I do have a GPO that sets up a scheduled task to run this command at set times.

 

Program / Script: C:\WINDOWS\System32\shutdown.exe

 

Arguments: /s /t 60 /c "Automated daily shutdown, Save your work!"

 

Works great here!

Posted

I think thats what we used to have, but due to a Microsoft update in may it no longer works.

 

CPassword attribute error - known security risk - ms14-025 being the cause of my misery

Posted
We have configured a GPO to add shutdown tasks to the individual machines here. The one issue was a few users who had local admins (proves that there are not many we can trust with local admin rights ) abused their permissions and removed the tasks.
Posted (edited)

There were a few stages to the task

 

1. Had to Enable task scheduler (it was disabled due to a virus infection before my time here).

2. Startup script to add the shutdown task, 21:50 is the start time of the script run

SchTasks /Create /SC DAILY /TN "Shutdown" /RU System /TR "\\domain.net\netlogon\shutdownmc.bat" /ST 21:50 /F

 

 

3. The shutdownmc.bat that runs from the sysvol share has the line

 

shutdown.exe /s /c "Your machine will shutdown in 10 minutes. IT Services" /t 600 /f /d p:4:1

 

Test on a few machines before you roll out everywhere.

Edited by Davit2005
Posted

MS14-025

 

https://technet.microsoft.com/en-us/library/security/ms14-025.aspx

MS14-025: Vulnerability in Group Policy Preferences could allow elevation of privilege: May 13, 2014

 

It didn't effect existing group policies, unless you tried to modify the policy.

It only became a problem for us last month when we had an open day and thus disabled the policy.

 

When we tried to re enable the policy it wouldn't let us.

Posted

quser | find "Active"
if %errorlevel% == 1 shutdown /s /f /t 30 /c "Automatic shutdown"
EVENTCREATE /T ERROR /L APPLICATION /ID 666 /SO "AUTOMATIC SHUTDOWN" /D "AUTOMATIC SHUTDOWN - %errorlevel%"

 

We use this bat file, and GPO to set it as a local scheduled task to run every hour from 6pm until 2am.

 

It'll shutdown the machine only if no-one logged down on, and will log results to event viewer (Mainly just for testing/seeing why things don't restart)

 

Not sure if you wanted it server side or just options but there we go :D

 

Steve

Posted

Hi we use a batch script which runs from a task schedule run off a server, which looks like this:

 

shutdown /s /m \\Computer-01231 /t 120 /c "School Auto Shutdown Service. Please save your work."

shutdown /s /m \\Computer-01232 /t 120 /c "School Auto Shutdown Service. Please save your work."

shutdown /s /m \\Computer-01233 /t 120 /c "School Auto Shutdown Service. Please save your work."

 

Jon

Posted

i have a GPO that makes a scheduled task on all of the desktops

 

1NQ0clH.png

 

eXVxTWt.png

 

wXwmUPJ.png

 

we used to used a batch script too but i replaced it with this - it can be a bit of an effort to stop it on the few days that the school is open late but I'm sure the electricity savings are worth it, though its disabled at the minute because of people working late last night. I'm sure you could be creative with conditions to get it to only do it if the computer isn't in use etc

  • 3 weeks later...
Posted

Found a solution in the end.

We found that on a machine with the scheduled task still present we were able to export a XML file to deploy to all our machines.

 

How are your GP's working? we can't ours to work for love nor money. same error every time, GP won't let us store a password when making a scheduled task

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