Blog Post

Time Based Power Settings

,

Just recently I was part of an online presentation in which the intended audience was unable to install any of the screen sharing programs which my company had at our disposal (WebEx, GotoMeeting, Join.Me). The prospective client proposed we use their screen sharing program, Adobe Connect to perform the presentation, which seemed like a feasible idea, until our primary presented was unable to get it to connect.

The quick solution was to have someone that could connect to both systems ‘bridge’ the two screens together, essentially daisy chaining the two screen sharing application. Guess who was the lucky ‘tech’ guy on the call. Thats right, yours truly.

One of the problems I had was my multi-monitor, super awesome machine was now under the scrutiny of both my co-workers and our prospects, negating me from doing any multi-tasking on the other screens for fear of letting my lack of attention be known. (Side Note: Normally i’m very well tuned into conference calls, just not so much for presentations I see a few times a week)

Being the enterprising young lad I am, I thought this an opportune time to head down stairs to grab some lunch only to come back and find my monitor had went into power save mode a few seconds before. A quick wiggle of the mouse and we were in business.

Now I’m pondering, how do I prevent this? I could simply change the power settings to a larger time, but that would leave all three of my monitors on for X amount of hours AFTER i quit using the computer. I could setup two profiles and switch between them in the morning and night, thus allowing my screens to turn off quickly when I’m not likely to be there and stay on indefinitely when I am supposed to be there….or I could Powershell.

Of course, Powershell is the answer here.

$a = Get-Date
function SetPlan([string]$Plan) 
{
    $guid = (Get-WmiObject -Class win32_powerplan -Namespace root\cimv2\power -Filter "ElementName='$Plan'").InstanceID.tostring()
    $regex = [regex]"{(.*?)}$"
    $newpowerVal = $regex.Match($guid).groups[1].value
    powercfg -S  $newpowerVal
}
$Plan = if ($a.Hour -gt 7 -and $a.Hour -lt 18) { "Long Term" } else { "Short Term" }
SetPlan $Plan

Now with this handy little piece of awesomeness run hourly by Task Scheduler , my Power Settings are changed to my “Long Term” power saving plan between 7AM and 6PM and to my “Short Term” power saving plan all other hours.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating