Welcome to DS Homebrew!

Hope you enjoy your visit............

Access Power Management and Scheduler VBScript

Posed on 2009-08-11 00:14:00

Author: Gareth Bennett

I like listening to music/pod casts when I am going to sleep. However, I don't like leaving my computer on all night.

I needed a script to do the following:-

  • Switch my Monitor off
  • Shutdown the Computer after (x) amount of time

Here is the Complete Code, all you need to change is (Hour) and (Min):-

Option Explicit

Dim objShell, Hour, Min, strPowerManagement, strShutdown

Hour = 0
Min  = 0

strPowerManagement = CStr(Hour) & ":" & CStr(Min)
strShutDown = CStr(Hour) & ":" & CStr(Min + 1)

Set ObjShell = CreateObject("WScript.Shell")
objShell.run "powercfg.exe /X 1 /N /monitor-timeout-ac 1"

Rem Sheduled Tasks
objShell.run "AT " & strPowerManagement & " powercfg.exe /X 1 /N /monitor-timeout-ac 0"
objShell.run "AT " & strPowerManagement & " powercfg.exe /X 1 /N /disk-timeout-ac 0"
objShell.run "AT " & strPOwerManagement & " powercfg.exe /X 1 /N /standby-timeout-ac 0"
objShell.run "AT " & strShutdown & " shutdown.exe -s"

Set ObjShell = nothing

Here is what the full script does in brief:-

  • Chanages the Mointor Setting in Power-Management to Switches off the monitor in 1 minute.
  • Schedules the commands to set Power-Management back to setting I like.
  • Schedules the System to Shutdown, 1 minutes after the Power-Management schedule have been initiated.

Comment : 1

Gaz Posted On 2009-08-31 13:59:55

Visit Website

Test Comment

Please insert the code below into the box marked Captcha before posting.