Powering Machines Down

This issue has been solved. See solution.
fil_b's picture

Hi There

With DS how easy is it to shut machines down that are left on over night, but if the machines are switched off they just left alone

From searching i have found alot of people have issues where the machine is switched on the next morning it then task runs and switches it off.

I have found this belowe
 

  1. Create a job
  2. Leave the default condition blank
  3. Create a second condition
  4. Add a User Defined Token with the following criteria.
  • Operation = contains
  • Value = 2
  • Token = %#!computer@icon%
  1. Create a second User Defined token with the same criteria except make the Value = 25
  2. Now change the joining criteria for both Tokens an OR instead of AND. Simply do this by right clicking on the AND value and selecting OR in the context menu.

The value 2 represents the icon used when the computer is on but no user is logged in. The value 25 represents the icon used when the computer is on and a user is logged in. I verified this by running some sql queries.

I then ran this against a computer in my lab that was on but no user logged in (successfully turned it off), computer on with user logged in (successfully turned it off), and then computer turned off.

When the job was assigned to a computer that was off it immediately gave an error. The Status showed "Sending Wake-On-Lan signal, however if check the Status Details on that system it showed "Error" No condition items exist."

You could also use similar logic to not run a job on computers that are turned off. The value for the Not Powered On icon is 0. I have also seen the icon value be 41 for systems that are Not Powered On.

Any one advance on this as i am finding this is waking up machines that are switched off the shutting them back down, or switching the machine off when its switched on in a morning

Thanks

Phil

JoshBauer's picture

Phil, That is a great

Phil,

That is a great idea! And never thought of doing that, but to fix your problem, 

In the condition "Computer Off" Instead of nothing in the task list, add a Run Script and just type "REM Already Off" in the script window and on the next pane change the script to run locally on the server and untick "Run when agent connect".

This will do everything on the server, and will never try and wake the agent, because it doesn't need to.

I'm going to do some more testing and let you know, but maybe reforming this so as to have the status window show if it was "already on" or "already off" or any other options.

Josh

JoshBauer's picture

Phil, I've done some more

Phil, I've done some more testing, and got this nailed.

Using your idea for "Computer On" and adding a shutdown power procedure to the condition.

Then adding another Condition called "Computer Off" under this condition add the user defined conditions as you did for both 0 and 41. Then in the task pane add "Run Script".

In the first pane of the wizard, type in:

REM Computer Already Shutdown
EXIT 1

This will give the label to Altiris of Computer Already Shutdown and will exit always with a code of 1, this I will explain more later.

In the next pane of the wizard, for script run location select "Locally on the Deployment Server" and untick "Run when agent is connected"

In the last pane of the wizard, add a return code of 1 (WARNING: untick add to master list!!) with the:

Response: Continue
Result: Success
Status: "Power Management task complete".

Click finish and run!

Hope this helps (it's helped me thanks!),

Josh

bwilkerson's picture

Details on Task Setup Please

Taking the information above can you describe in detail on the task set up from start to finish?   I have posted many places on this subject and I want to be sure I have it exactly right.   In your tests did the job re-schedule like it should?   If this works I will be very grateful as I was thinking I may have to get a third party utility to do this.   I have tried scripts and other methods that work but the problem is there is no warning to the end user.     With Altiris I checked the option to prompt the user on shutdown and restart and set the time for 120 seconds and that way the user can abort or delay the job.    In the task I set the time to defer job up to one hour and so far that has been working as I have been manually running the job I set every night on active computers.    If this method will make it automatic and reschedule it that would be awesome.

JoshBauer's picture

bwilkerson, please refer to

bwilkerson, please refer to the article I wrote about this.

http://www.symantec.com/connect/articles/power-management-shutdown-without-headaches-aka-wakeups

Hope that helps.

Josh

bwilkerson's picture

Not Authorized

Says I am not Authorized to view that link.  

ohzone's picture

That article is live now -

That article is live now - thanks Josh for posting it!

Endpoint Management & Virtualization
Community Manager
www.twitter.com/EMnV_symc

JoshBauer's picture

Sorry didn't realise it took

Sorry didn't realise it took sometime for articles to appear, please check back on that later.

Josh

fil_b's picture

Hi JoshGood to hear that you

Hi Josh

Good to hear that you can add the to info i posted.

I found that code off another site.

What info did you need in the script that runs??

thanks

Phil

also, the link you posted i can access it - says i am unauthorised

JoshBauer's picture

Hi Phil,Don't quite

Hi Phil,

Don't quite understand what you mean by your question, however what im assuming is what do need to write in the script, and the anwser to that is nothing at all, HOWEVER I put in mine

REM Computer Already Shutdown
EXIT 1

Only because then I can setup and status update in the console window using return codes.

The only other thing is to make sure you select the script to run on the sever and that the agent dosn't have to be connected for it to run.

Does that answer your question?

Also yes that article was only posted this morning and apprently it takes sometime for the articles to come up. Sorry about that.

Josh

fil_b's picture

Thats cool Josh I need to

Thats cool Josh

I need to look into the script then and run that as the 1st job.

Will let you know my findings

Thanks

Phil

fil_b's picture

Hi josh, I have come to put

Hi josh,

I have come to put the script in to the job,

I currently have the power control task, do i run the script job before the power control job?

hope that makes sense

Thanks

Phil

JoshBauer's picture

Phil that link is live now,

Solution

Phil that link is live now, go take a look at the whole process.

http://www.symantec.com/connect/articles/power-management-shutdown-without-headaches-aka-wakeups

Josh