Scheduled Computer Power Control question
I have created a job to shut down the computers in classrooms throughout my school at the end of each day. The problem I've noticed this morning is that all of the computers that were already turned off, are getting turned off when the machines are turned on in the morning. Is there a way to "skip" the machines that are already powered down when the daily job runs?
Work Around Solution
One thing you can do for now is to send a Wake-on-LAN task to wakeup all the PCs and then apply the shutdown job. This not might be the best solution but it will buy you sometime till you find another solution.
we had the same issue
and solved it by writing VBscript that check the time before it execute shutdown.
so if we set the schedule to run in 19:00
we set the VBscript to make sure it's 18:30 to 19:30
and if not the script abourt.
in the morning, when the task try to run on comuter that was already shutdown, the script abourt becuase the time check fail.
i will post the script as soon as i can...
The script
If you could post the script, that would be great!! Thanks for your help.
here it is
i post is also as download but meanwhile:
' This script check the current hour to decide if the application should run or not. ' there is three modes for the script : Disable time check, same day check, and next day check. ' Writen by Dima and haim. On error resume next Err.Clear dim objshell dim startTime dim endTime dim useTime dim nCurrHour dim sameday ' Enable or Disable the time check. ' set 0 to disable time check ' set 1 to enable time check useTime=1 ' Set if the time check is for the same day. ' set this to 1 if the start and ent time are in the same day. ' set this to 0 if the end time is in the next day. sameday=1 ' Set start time of the script. startTime=21 ' Set end time of the script. endTime=5 nCurrHour=hour(now) wscript.echo "Current Time: " & nCurrHour if sameday = 0 then if ( useTime and not ((nCurrHour >= startTime and nCurrHour <= 24) or (nCurrHour >= 0 and nCurrHour < endTime ))) then wscript.echo "should run in: " & startTime & " and " & endTime wscript.quit (-1) end if else if ( useTime and not ((nCurrHour >= startTime and nCurrHour <= endTime ))) then wscript.echo "should run in: " & startTime & " and " & endTime wscript.quit (-1) end if end if set objshell = CreateObject("WScript.Shell") ' Insert here your Application to run objshell.run "%windir%\notepad.exe" if Err.number<>0 then wscript.echo "Error: " & Err.number & "," & Err.description wscript.quit Err.number else wscript.echo "DONE OK! " wscript.quit 0 end ifnote that...
note that i left the "Wscript.echo" lines
because you can use it in altiris to track errors.
just remember when you create the task to select under "Advenced" :
this alow you see all the computers that tried to
run the script in the morning.
Shut Down should not be this difficult
I am having the same problem the only issue is that WOL doesn't always work very well in my network environment and I am not sure why. Also users that have laptops that may not be on the network at the time of shutdown WOL will not help those. Sometimes those users leave their laptops in the building connected to their Docks but other times they take them home. It seems rather silly for Altiris to power up a machine just to shut it down. I mean in the Power Control task it says "Shut Down (If Available)" Shouldn't that mean shut down the computer if it is not already turned off? Any recent developments besides using a script similar to the one above. Is there some sort of time out feature that can basically cancel the job if the computer doesn't respond so it doesn't force the job to run the next time the computer makes a connection? I had a similar task set up in our Old Ghost setup just running the shutdown command line in a job and if the computer didn't respond it just came up failed on that computer but the computers that were on all shut down fine.
use a user defined token condition
You can use a user defined token condition on the job. You can use the icon field in the computer table of the express database to see whether the computer is on, logged in, or off.
Here is an example of how you can set this up:
Select user defined token in the condition creation dialog
Change the operation to "is exactly"
Change the value to 2
Copy the following into the token field: %#!computer@icon%
The value of 2 in the icon column means that the computer is on but no one is logged in. You can use any combination conditions to add the different states of the computer you would like the job to run in. (I believe a logged in computer is 25)
If you want to shutdown both logged-in and computers that are on but not logged in you can change the operation to "starts with" and keep the value at 2. This will grab any of the computers that begin with 2. ( 2 and 25 are the only values I have seen but you might want to double check to make sure there are not others).
Once the condition is created add the shutdown task under that condition and leave the default condition blank. Any computers that meet the condition will run the corresponding tasks and those that do not meet the condition will fail.
User Defined Token @jmecham
You are correct on your tokens as I verified on another site. Seeing as we could have both scenerios in which a computer could be logged off but left on or logged in and left on do you think it is safe to add both of these conditions to the same power down job?
Basically I would have the condition drop down menu look like this
default
Power down computers left on - using the value of 2
Power Down Logged in Computers - using the value of 25
The Operation, token, and other fields would remain the same right?
Then add the power down task to each condition separately.
Am I getting this right?
That is correct
That will work. Also, in response to your question about assigning the job to a group and then later adding a computer to that group, that computer will not automatically be assigned the job. There is no persistant link to the job and the group.
Well Darn. That is one
Well Darn. That is one feature that I will miss from the old Ghost solutions suite that we had. I guess we will just have to remember to keep an eye on those jobs when we have to move computers around.
Easier way
Much easier to use Group Policy to control.
http://www.energystar.gov/index.cfm?c=power_mgt.pr_pm_ez_gpo
Thanks for the GPO suggestion
We looked into that but our problem is our machines do not necessarily shut down at the same time...even machines in the same OU. We are a school district and we would want to shut our lab computers down at one time, our general office computers down at maybe a later time, and finally our individual user workstations at a different time. We found that you could not be as selective with the GPO Method.
I will try that User Defined Token Method and see if that works.
One other question if I may and if I should ask this in a separate place let me know. I have found if I assign a job to a computer group such as this shutdown job it will not automatically apply to a new computer added to that group.
GPO is an option...
...depending on how aggressively you want to manage computer exclusion groups. You could link 3 separate GPOs on the OU, but deny Read rights to those GPOs to all but the targeted machines.
Thanks,
Kyle
Symantec Trusted Advisor
If your question has been resolved, please be sure to click "Mark as Solution"! Thank you.
Related Question
I have made my power down task(s) and a concern was raised by my Administrative staff. If I set the computers to shut down and someone is logged in is there a way to make the condition using value 25 to prompt and wait maybe 5 - 10 minutes to allow a person that may actually be logged in using the computer to cancel the task. I think I have it to force shutdown as that was what was recommended by the Altiris setup. So basically if the computer is on but not logged into the computer would just shut down, but if it is logged in there will be a prompt allowing a user to click cancel or no and continue working. If no response to the prompt is given after a certain time period the shutdown task would continue.
Access Tab of Aclient
Yes, you can specify that in the AClient/DAgent settings. It is on the "Access Tab". I believe it defaults to 10 seconds.
Duh!
I should have seen that. Thank You for the information.
Ok this is not working.
I am not sure why but the power shutdown tasks I set run it seems to work but if it runs on a computer in the group that is off and fails it does not reschedule for the next time it is supposed to run.
When I go to apply this Shutdown job I get a message that says: Warning: You are attempting to schedule a job which does not have an tasks defined in the '(default)' condition" and I assume this is normal and to be expected. I have the task set up like this:
Under Conditions:
Condition 1: Power down Computers Left On
Field: User Defined Token
Operation: Starts With (also tried "is exactly" and "contains" because I read that in other places I found on the internet)
Value: 2 (For Powered on and Logged off computers)
Token: %#!computer@icon%
Condition 2: Power Down Computers Left Logged in
Field: User Defined Token
Operation: Is Exactly (also tried "contains" as that was what was said to set on another forum)
Value: 25 (For Logged in Computers)
Token: %#!computer@icon%
Condition 3: Default
Left Blank.
I guess I want to make sure that is correct of if someone could check over the details and make sure the condition values are as they should be. Also does the order matter? Like should default be at the top? Or should I put one condition over another?
Please Help because I am very frustrated and I find that I am having to VPN in every night and go to each Altiris Server and select the all Computers group and filter for Active Computers and shut them down. I set the countdown task so they get prompted but there are literally over 1000 computers left on each night and Building Management is blaming technology for the high electric bills.
Thank YOu in advance for helping me as I seem to be making this process more difficult than it should be it would seem.
Condition 3
I'm pretty sure that you should not leave the default condition blank. I would add a "run script" task in there with the following code as a place holder:
"REM DO NOTHING"
Thank You
I will try that. Do you think the order of the conditions matter? What about the condition variables specifically the Operation. I have been searching my fingers to the bone on this and get some that say the Operation should say "Is Exactly" others that say it should say "contains" and then this one says the condition with the value of 2 should say "Starts With"
conditions
I don't believe it matters what order the conditions are in. The default condition is for any machines that do not match your other conditions, they have to have something to do, even if it is a place holder.
As for the condition variables. It all depends on the variables that you are looking for and your tolerance for it not being exact.
For example, if you know that the variable should be equal to "2" and there should be no chance that it should be anything else, then you should have "Is Exactly", if there is a chance that your variable may be "2.0", then you might want it to be "Starts With".
I would be very careful with "contains" if you are using numbers. It can really throw you for a loop if you are looking for a variable of "2" but choose "contains" and get a variable of "958723" (as that variable contains the number 2 in it).
Hope this helps.
OK I tried that:
And the script that says REM Do Nothing woke up the computers that were off and they stayed on because it initiated the WOL. The Power Down Task is as follows:
Under Conditions:
Condition 1: Power down Computers Left On
Field: User Defined Token
Operation: Is Exactly
Value: 2 (For Powered on and Logged off computers)
Token: %#!computer@icon%
Condition 2: Power Down Computers Left Logged in
Field: User Defined Token
Operation: Is Exactly
Value: 25 (For Logged in Computers)
Token: %#!computer@icon%
Condition 3: Default
Run Script: REM Do Nothing
I guess I do not know why a power down task would want to wake up a computer and shut them down again. Many of our computers have WOL enabled and since I can never tell what computers will be left on each night I need a task that will not wake a computer up and only shutdown computers that are on. Isn't there something that can detect if the computer is on before it runs the task.
Design Flaw
Unfortunately, that is a design flaw. If a machine is not powered on, Altiris will resort to WOL. I would say that may be a nice feature request on the Ideas forum, allow us to decide if WOL is necessary (checkbox), also wouldn't be a bad idea to set a timeout so that a job doesn't just sit there forever waiting for the machine to power up to run itself (i.e. if WOL wasn't working for you, what would happen would be the person would boot up the computer, it would check in, see that it has a job to run, and then run your shut down job. Obviously, that would not be the desired result).
Another way of doing things to ensure that all of the machines are in the same state, maybe schedule a job to all of the machines to get them all powered up, and then have a scheduled job shut them all down. This might be a good time to schedule updates at night as well (i.e. Windows Updates, Virus Def updates, any other maintenance that should be done during off hours).
It's not a very good method
It's not a very good method because it could mean other reasons, but maybe ping the pc using the script? If no responce, then don't send shutdown.
Don't know if this has been
Don't know if this has been sorted yet, but using alot of the ideas from here and on this thread i've pretty much got it down pat.
http://www.symantec.com/connect/forums/powering-machines-down
Machines now will not wake up to shutdown.
Josh
I replied on the other
I replied on the other thread. If your task works please post details. If you autoschedule this to run every night does it reschedule like it should?
Here is the script I use to shutdown my labs.
The job is scheduled to run everday at 4:30 PM, the shutdown command is skipped if the first 3 characters of the %date% variable are equal to Sat or Sun, the job will also skip the shutdown command if the first character of the %time% variable is not equal to 4. So in a nutshell the computer will only shutdown if the day is Mon - Fri and the time is between 4:00 and 4:59.
I hope this helps.
Would you like to reply?
Login or Register to post your comment.