Login to participate
Endpoint Management & Virtualization ArticlesRSS

Power Management: Shutdown without Headaches (aka Wakeups)

JoshBauer's picture

One of the biggest downfalls of Altiris Deployment Server, especially for today's IT staff (with companies signing new green policies and what not), is the serious lack of powerful features available for power management. Yes there are shutdown and restart and wakeup commands, and you create a "simple" schedule for one set of computers (at different times), but what I'm talking about here is the ability to take control of the power management and create rules that make things easier on you and your team.

The simplest rule I'd like to see, which I thought would have come standard, is the ability for Altiris to know "If the computer is off, don't shut it down". This is especially annoying with the problems of WSUS where it will go to restart your computer at night and get stuck on shutdown. A person would come in the morning, move the mouse and the computer will restart from the hanging shutdown, but Altiris doesn't know this and once the computer is on it will shut down again, VERY ANNOYING. Also the fact that Altiris has to wake up a computer to shut it down is just silly, this wastes time and power (money).

So with some research, testing, determination and the help of many people on these forums, I've come up with a workable solution to not having a PC wakeup to shutdown. What this solution does is read from the SQL database each computer's current icon, if it is on but not logged on (value 2), on and logged on (value 25), or off (value 0 or 41). It then does what you want it to do in comparison to the condition you have set. This format also allows for scheduling a shutdown so you can set it to go every 1 day at anytime. Once it's completed it will reschedule for the next day. You could potentially use this for other instances as well. Say you need to install software ONLY when a computer is NOT logged on. For instance, you could set a condition that will run to say a job was not completed because someone was logged into that computer... but that's another article.

For now let's start working on this shutdown problem!

Step 1. Create a new job and call it "Shutdown", or whatever name you'd like really.

imagebrowser image

Step 2. Leave the Task Pane of the "Default" condition empty. Create a new Condition called "Computer On"

imagebrowser image

Step 3. In the Condition Settings window Click "Add" and insert these details, then click OK:

Field: User Defined Token
Operation: contains
Value: 2
Token: %#!computer@icon%

imagebrowser image

Step 4. Click "Add" again and insert these details, then click OK:

Field: User Defined Token
Operation: contains
Value: 25
Token: %#!computer@icon%

Step 5. Right click the "AND" in the middle and change it to "OR" then click OK

imagebrowser image

Step 6. In the task pane you can add how you want to shutdown a PC. I use the Altiris shutdown power control, this allows for feedback and it also allows for end user to cancel or postpone the shutdown for a period of time. Just before that I also include a Kill Screen Saver script using pskill.exe, this stops that nasty screen saver hang on some machines when shutting down.

click enlarge

Step 7. Create another new condition, this time called "Computer Off". We are going to do exactly what we did with conditions before, but this time we are going to change the values to 0 and 41. See below

imagebrowser image

Step 8. Once you have created the conditions, in the task pane create a "Run Script" task and type the following into the "Run this script:" box, then click next

REM Computer Already Shutdown
EXIT 1

click enlarge

Step 9. Under Script Run Location select "Locally on the Deployment Server" and untick "Run when agent is connected" then click next

click enlarge

Step 10. In other return codes, click Add. And type the following (and don't forget to untick "Add to Master return code list"):

Code: 1
Response: Continue
Result: Success
Status: Computer already shutdown, task complete

click enlarge

Step 11. Once you click finish your shutdown procedure is ready to go!

This works well for me, managing 400 computers in a college with both staff and student pc's, with different shutdown times and running WSUS.

This is my first article so any improvements or criticism is certainly welcome!

bwilkerson's picture

DUDE! If this works I so owe you one

I have like 2500 computers to manage and it has been a nightmare with our Buildings and Grounds manager basically blaming the computers for the high electric bills.  He is probably right but when I mentioned that Staff should be responsible for shutting down their own computers and teachers should have their students shut down the lab the last period of the day I was told that is an unreasonable request and that my small tech staff is responsible for shutting them down.

I plan trying this right away and I will post back my results.  Thanks again as this has been a major thorn in my side and from what I have seen many others too.

UPDATE: Various Shutdown Tasks created for my computer groups.   I will check in tomorrow morning to see if they were successful and rescheduled as they should.

JoshBauer's picture

Good luck mate, I'm planning

Good luck mate,

I'm planning on doing another article soon in relation to scheduling and all that as well.

Hope this does work out for you, worked well for me!

Josh

fil_b's picture

Dude looks good just need to

Dude

looks good

just need to add the step for adding the power control to shut the PC's down

Glad i could help with the code

Thanks

Phil

JoshBauer's picture

Thanks Phil, Do you mean

Thanks Phil,

Do you mean elaberate on Step 6?

Josh

fil_b's picture

My Bad dude Looks good

My Bad dude

Looks good that

:D

missed step 6

bwilkerson's picture

Seems to work perfectly

No WOL wake-ups, Powers off the computers and Reschedules.   Just what I needed.  Thank You very much for spending the time to figure this out.