Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

Power Management: Shutdown without Headaches (aka Wakeups)

Updated: 02 Sep 2009 | 11 comments
JoshBauer's picture
+7 7 Votes
Login to vote

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!

Comments

bwilkerson's picture
02
Sep
2009
0 Votes 0
Login to vote

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
02
Sep
2009
0 Votes 0
Login to vote

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
02
Sep
2009
0 Votes 0
Login to vote

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
02
Sep
2009
1 Vote +1
Login to vote

Thanks Phil, Do you mean

Thanks Phil,

Do you mean elaberate on Step 6?

Josh

fil_b's picture
04
Sep
2009
0 Votes 0
Login to vote

My Bad dude Looks good

My Bad dude

Looks good that

:D

missed step 6

bwilkerson's picture
04
Sep
2009
0 Votes 0
Login to vote

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.   

Blaat's picture
26
May
2010
0 Votes 0
Login to vote

Need some help with this.

Hey all,

I'm kinda new with DS, but I wanted to make a job so I can shutdown computers at night that are On but no one is logged on.
After making a job discribe in the first post and sending it to a computer noting happens. When I did a closer look at the job it seems that it skiped the User Defined Condition and just did the default one.

This is the Condition for the computers that are on but no one is logged on.

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

Also made a Condition for computers that are off:

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

And in the default Job I made a script With only  "REM Do Nothing".
It seems that the conditions are right, but i can't find the thing i'm doing wrong.

I know this topic is kinda old, but still i hope some one can help me.

Thanks

Petrucci914's picture
14
Sep
2010
0 Votes 0
Login to vote

I just scheduled this over

I just scheduled this over our entire school district (1800 machines).  I did it by buildings depending on when the school was dismissed.  At our larger schools it did turn on machines, oddly enough.  I think I scheduled too many at the same time and it couldn't read the SQL database and instead, woke up the machines......but that's just a guess.

 

When we say 'contains' 2, 25, etc........would it benefit us to put 'exactly' instead?

Altiris in Peoria AZ's picture
21
Sep
2010
1 Vote +1
Login to vote

The built in Shutdown command

The built in Shutdown command is kind of a blunt instrument.  I use Microsoft's psShutdown utility (sysinternals) to put up a five minute prompt that logged on users can use to cancel the shutdown if they're actually using the computer.  I have psshutdown.exe on all our computers.  Here's the command in the job:

psshutdown -c -f -t 300 -accepteula

If you don't have psshutdown already in place I imagine it could be the first line of your script to copy it to the computer, then the next line would run it.  I like to do a check when copying files, something like

if not exist c:\windows\system32\psshutdown.exe (xcopy \\server\share\psshutdown.exe c:\windows\system32)

Altiris in Peoria AZ's picture
21
Sep
2010
1 Vote +1
Login to vote

Oh PS: i changed the

Oh PS: i changed the "contains" operation in the conditions to "is exactly" and it works.  Probably better.

gpouser's picture
06
Oct
2011
0 Votes 0
Login to vote

need help with this shutdown job

I wanted to run the shutdown Job each day of the week, I have resolved this problem with:

Create the Two scripts one for shutdown the other for WOL as below; place them in a folder C:\RunSchedule, modify your script to where your:

Program Files (x86)\Altiris\eXpress\Deployment Server\axSched.exe is located in my case its the d: drive but this may well be the default c:

Create a Task Schedult on the Altiris Server

 

 

shutdown computers in Altiris when using a selected shutdown schedule

C:\RunSchedule

shutdownStudents.cmd
--------------------------------------------------------------------------------------
d:
cd "\Program Files (x86)\Altiris\eXpress\Deployment Server"
axSched.exe Classrooms shutdown /t 18:15

-------------------------------------------------------------------------------------

wolStudents.cmd
 

-------------------------------------------------------------------------------------
d:
cd "\Program Files (x86)\Altiris\eXpress\Deployment Server"
axSched.exe Classrooms WOL /t 07:30

-------------------------------------------------------------------------------------

 

Schedule for each day of the week, provide your user: administrator with password

 

 

axSched.exe Classrooms shutdown /t 18:15

This shutdown group "Classrooms" with the Job shutdown at 18:15 the Task Schedule has to run before say 18:00 as above.

The same can be done if you create a WOL to start your computers up, the default task should have a dummy line Rem This is dummy script

The dummy script allows to Job to complete without error on the default task

TaskSch-days.jpg TaskSchedult.jpg