Jump to content

Recommended Posts

Posted
yeah I couldnt logon..but clicked blogs and there was shutdown software link in there somewhere..downloaded and runs perfectly.

 

Got a scheduled task set within group policy to run it. PERFECT!

 

Thanks :) save a fortune with these staff who are too lazy to shutdown each night.

 

Does it work when a user has locked the machine beforehand? Our users tend to lock the machine and then go home.

Posted
The best free standalone shut down program I've seen ( and use in all my seven schools) is poweroff. It's an exe that let's you create a service that shuts down the machine at a certain time. You can also configure it to pop up with a notice that states that the machine is shutting down and to cancel this action press cancel.
Posted
The best free standalone shut down program I've seen ( and use in all my seven schools) is poweroff. It's an exe that let's you create a service that shuts down the machine at a certain time. You can also configure it to pop up with a notice that states that the machine is shutting down and to cancel this action press cancel.

 

How does it cope with locked machines?

Posted

Just got shutdownTool up and running

 

How does it cope with locked machines?

 

I noticed in the task scheduler you have the option to run even if nobody is logged in.

 

I need to work how to only get the software to run when in school and not if a teacher takes a laptop home. Any ideas?

Posted
Just got shutdownTool up and running

 

 

 

I noticed in the task scheduler you have the option to run even if nobody is logged in.

 

 

I need to work how to only get the software to run when in school and not if a teacher takes a laptop home. Any ideas?

 

But if the machine is locked then someone is logged on.

Posted (edited)
Anyone have issues with shutdown scripts that sometimes leaves machines without a logon screen the next morning ? ctrl-alt-del brings it back. It's quite random and I can't replicate it during the holidays. (XP) Edited by caffrey
Posted
But if the machine is locked then someone is logged on.

 

You might want to look at the GP preferences / control panel / scheduled tasks.

 

It has options like 'run weather a user is logged in or not' 'run with higher privelges' Would have thought (but not tried) that it must be possible.

 

Also not sure what /f = (Forces the chosen action) would do which is part of the ShutdownTool.

Posted

Just thinking through using the Config Manager Shutdown Utility with SCCM.

 

If you advertise a shutdown at say... 5pm, aren't all the computers that were off pick up the advert the next day when they power on, and then shut down?

Posted

You could always set up maintenance windows and make sure that it doesn't run outside of those.

 

Of course, that would bugger up anything else you've got going inside maintenance windows :)

Posted
You could always set up maintenance windows and make sure that it doesn't run outside of those.

 

Of course, that would bugger up anything else you've got going inside maintenance windows :)

Gah! There's always something! :)

 

Might be easier to use a scheduled task as per @edutech4schools suggestion

Posted

I'm having trouble getting the gui to show on the scheduled task, even with interact with desktop ticked on task scheduler service.

 

Going to play some more on this tomorrow.

Posted
Does this work with win 7? Don't think that he ever released the promised version for this.

 

I'll try and catch him to find out, don't think he visits the site anymore.

 

Like you said although it does state partial win 7 support on the site ??

Posted
Just thinking through using the Config Manager Shutdown Utility with SCCM.

 

If you advertise a shutdown at say... 5pm, aren't all the computers that were off pick up the advert the next day when they power on, and then shut down?

Duh! Helps to read the arguments file. You can specify some options when not to run the shutdown, eg time past since last shutdown is greater/less then a set amount.

That should sort the problem.

Posted (edited)

I'm running that Coretech shutdown tool for logged on users.. but i'm also running a shutdown vbs script that will shutdown any computers

left on, but logged off. Find this with a LOT of student computers where the teacher hasnt bothered to shut them down.

 

Works perfect! I've added it to task scheduler to shutdown at 4pm and again later in case some are here later, but fail to shutdown.

 

'* Script Name: ShutDownIfNotLoggedOn - Local.vbs

'* Created On: 12/13/2007

'* Author: Michael C. Panagos

'* Website: Real solutions shouldn't be hard to find - The Grim Admin

'* Purpose: Script to get current user logged on and perform shutdown on computer if no one is logged on

'* History: Michael C. Panagos 12/13/2007

'* Initial Draft.

'* Legal: Copying and distribution of this code, with or without modification,

'* are permitted in any medium without royalty provided the copyright

'* notice and this notice are preserved. This code is offered as-is,

'* without any warranty.

 

 

'Account used to run script needs WMI permissions to shut down computer.

 

'Set error capture

On Error Resume Next

 

'Get local computer name

Set wshNetwork = WScript.CreateObject( "WScript.Network" )

strComputerName = wshNetwork.ComputerName

'strComputerName = "ComputerABC" 'For testing specific computer

 

'Setup WMI calling for logon name and shutdown assignment

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputerName & "\root\cimv2")

 

'Get currently logged on user's username

Set colComputer = objWMIService.ExecQuery _

("Select * from Win32_ComputerSystem")

For Each objComputer in colComputer

If IsNull(objComputer.UserName) Then 'If no one is logged on

strLoggedOn = "No"

Else

strLoggedOn = "Yes"

End If

Next

 

'If no one is logged on shut down the computer

If strLoggedOn = "No" Then

For each objOperatingSystem in GetObject("winmgmts:{(Shutdown)}!").InstancesOf("Win32_OperatingSystem")

objOperatingSystem.Win32Shutdown 1

Next

End If

Edited by ChrisN-0123
Posted
I thought that if you had the scheduled task set to login as an admin and with elevated perms you could run Coretech shutdown tool when not logged in. When I get a chance I will test, as that is a much simpler method.
  • 5 months later...
Posted (edited)

I have just set up a scheduled task via Group Policy Preferences, which detects if anyone is logged on, and if not, shuts down the machine when it is idle.

 

This is all without scripting etc - performed entirely with built-in Windows tools and Windows Batch FTW!

 

Control Panel Settings/Scheduled Tasks
New Scheduled Task (Windows Vista and later)
	Action: Replace (required to be able to remove it when it falls out of policy)
	Name: Shutdown on Idle
	When running the task, use the following user account: NT AUTHORITY\System (just enter 'System' in the selection box)
		(Run only when user is logged on - default - works fine)
		(No need to run with highest privileges - works fine)
	Triggers...
		New Trigger -> On idle
		Repeat task every: 5 minutes
			For a duration of: Indefinitely (catch cases where the user logon state changes while still idle)
		(Activate: set to the time we created the task)
	Actions...
		New Action -> Start a program
		Program/script: %ComSpec%
		Add arguments: /C "for /f "tokens=* usebackq" %i IN (`%WINDIR%\system32\wbem\wmic.exe ComputerSystem GET UserName /value ^| findstr /X "UserName="`) DO "%WINDIR%\system32\shutdown.exe" -s -t 60"
		(This command will run 'wmic.exe ComputerSystem GET UserName to detect if a user is logged on, and if the UserName field is blank, run the system shutdown)
	Conditions...
		Start the task only if the computer is idle for: 15 minutes
		(Can't get the idle timeout any lower than 15 minutes, as Windows only checks the state that often - [url]http://msdn.microsoft.com/en-us/library/windows/desktop/aa383561(v=vs.85).aspx[/url])
			Wait for idle for: Do not wait
		Stop if the computer ceases to be idle
	Settings...
		(Allow task to be run on demand - for testing)
	Common...
		Remove this item when it is no longer applied

Hope this might help some other people trying to achieve the same thing. As it says in the notes, it's hard to get the idle timeout any lower than 15 minutes, as Windows only checks the 'Idle' state itself that often. If you start up a machine and then wait for it to shut down, it usually takes about 26 minutes to do so - this is probably due to Windows not checking the idle state for at least 15 minutes after startup, plus the idle time itself. However if you wait it does work, and seems fine on all our computers so far.

Edited by Minkus
  • Thanks 1
Posted (edited)
Earlier in this post someone showed some PowerShell, you can do both with PS Stop-Computer will shutdown computers and along with Get-Content you could put the names of all the computers in a file and have it shutdown whole networks, or you could do something more sophisticated and create an array out of AD with the names of the workstations then I suppose you could test if they are powered up and if a users is logged in and the like (although Stop-Computer will throw an exception if a user is logged on and you don't use the -Force) all not so difficult if you spend a little time. Use along side WOL starter for 10 here Script Send WOL packet using Powershell again don't take much to make the script get MAC addresses from AD/ DHCP. PowerShell is your friend here and can save some money and I think if you give it a little thought you can make a solution that works well for your network needs rather then trying to make an off the shelf solution do what you want. Edited by HPlum78
  • 4 months later...
Posted
Will any of the above work in powering off the monitor as well?

 

Poweroff will work in powering off monitors as well as the workstation

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