just_david Posted January 5, 2015 Posted January 5, 2015 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.
Norphy Posted January 5, 2015 Posted January 5, 2015 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. 1
just_david Posted January 5, 2015 Author Posted January 5, 2015 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
fairm010 Posted January 5, 2015 Posted January 5, 2015 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!
just_david Posted January 5, 2015 Author Posted January 5, 2015 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
Davit2005 Posted January 5, 2015 Posted January 5, 2015 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.
just_david Posted January 5, 2015 Author Posted January 5, 2015 Would you be so kind as to share those gpo's? If i could make mine work again that would be great
Davit2005 Posted January 5, 2015 Posted January 5, 2015 (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 January 5, 2015 by Davit2005
simpsonj Posted January 5, 2015 Posted January 5, 2015 May, or may not, be helpful: Windows 7 shutdown through Group Policy Preferences - Blogs - EduGeek.net
just_david Posted January 5, 2015 Author Posted January 5, 2015 May, or may not, be helpful: Windows 7 shutdown through Group Policy Preferences - Blogs - EduGeek.net That appears to be how we're already doing it, and no longer works with the microsoft security update.
simpsonj Posted January 6, 2015 Posted January 6, 2015 Any idea which update? Fairly certain all security updates are applied on our machines and it's still working for us (I'll check tonight!)
just_david Posted January 7, 2015 Author Posted January 7, 2015 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.
Steve21 Posted January 7, 2015 Posted January 7, 2015 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 Steve
jslate1980 Posted January 8, 2015 Posted January 8, 2015 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
DGardiner Posted January 8, 2015 Posted January 8, 2015 i have a GPO that makes a scheduled task on all of the desktops 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
just_david Posted January 26, 2015 Author Posted January 26, 2015 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now