Shutdown computers with opt out message at a specific time.
Budget concerns are bringing out the energy committees to help reduce power consumption these days. While windows has built in sleep and hibernate options, these settings cause some challenges in our environment. Specifically we have lots and lots of public machines that need to have different staff members logging on to them all the time. Putting a machine to sleep just locks it so that others cannot use it and that not mentioned the small percentage of machines that just don’t want to wake properly afterwords. Thus we needed a method to shut down computers and give a half hour opt out message to anyone who might be using them. Here’s how.
Get a hold of Beyond Logic’s shutdown tool. It says it’s only for XP but it works fine in Windows 7 provided that you run it in the logged on users context. It’s the logged on users context that I’ve only been able to achieve with Altiris and cannot find a free 3rdparty tool capable of doing this. The whole reason I use this tool is that you can customize the message and it has a cancel (opt out) button unlike the built in shutdown.exe. You could make your own using autoit or autohotkey with msgboxes and the shutdown.exe command but it’s more work. http://retired.beyondlogic.org/solutions/shutdown/shutdown.htm
Create two tasks in your Altiris Console. The first is a task to copy the BLShutdown.exe file to the local C drive of all your machines. I tried using the built in copy task with Altiris, but kept getting failures when I tried to deploy it with a managed software delivery. This is true even though I could just schedule the task outside of managed software delivery and it would run fine. Thus, I used a script task to accomplish this.
Make sure you click Advanced and run the job with an account that has local admin rights on the computer and can access the network share that you want to copy the file from.
The second task actually runs BLshutdown. This task must be run as the currently logged on user or the message will not display to them.
Note that the script window is hidden. That’s so you don’t see a black command prompt window open to the user but they will still see the message box generated by BLShutdown.exe
Create the managed software delivery policies.
Navigate to Manage->Policies->Managed Software Policies in the console
Create a new policy
Add your two previously created tasks to the policy
The key is in the schedule section. Create a new scheduled time (repeat daily). Make sure that the task is only set to run if the computer is available at the specified time. Make sure you set it to only run if a user is logged on.
If all goes well, BLShutdown will copy itself and run at 5:30PM in my example and then ultimately shut down the computer at 6PM if a user does not click “cancel”.
But what about machines with no logged on user?
For these machines you need another task of Altiris’ built in “shutdown with force programs to close”
Create a new managed software delivery task and set it’s schedule to only run if there is no user logged in.
These machines need no warning or opt out message since there is nobody using them.