Link to home
Start Free TrialLog in
Avatar of rj22
rj22

asked on

Programically controlling advanced settings for schtasks.exe

Being somewhat familiar with schtasks.exe I have decided to use it to control the running of defrag.exe.  I've gotten to the point of polishing the features.

My problem is I want to configure the tasks on many machines (13000) programicatically and I need to configure the following settings programically of course.

Don't start the task fi the computer is running on batteries
Stop the task if battery mode begins
Stop the taks if computer ceases to be idle
Stop the task if it runs for <file in the time period>

Avatar of esromneb
esromneb

There is a wonderful program called autohotkey.  It it a very simple scripting language that will allow you to check for all of your conditions.  It will also allow you to to gracefully shutdown defrag once the computer goes on batteries.

Autohotkey also allows you to compile an exe out of the script, so you could just distribute and run the exe.

http://www.autohotkey.com/

P.S: may I suggest you also not run your defrag till the computer is idle?
Avatar of Merete
Hi rj22 I just dont think that is possible,there is no batch file or GPO that could regester  if the battery is running low?
It would have to be intergrated into that system and  on each system in a stand alone situation. Or intergrated into the mainboard sensors.

here is a good tip please browse thru to get some ideas.
http://www.windowsitpro.com/articles/print.cfm?articleid=50064
An extracted piece:
Diskeeper 10 runs as a service, monitoring system activity and performing automatic system idle-time defragmentation. Diskeeper 10 is intended to be placed into one of several "Set It and Forget It" scheduled modes; the product also supports standard time-of-day and day-of-week scheduling modes.

Management features. Diskeeper's new Administrator Edition is a console management program that lets you schedule and manage Diskeeper installations on servers and workstations across your network. Administrator Edition is a separate product and doesn't include the defragmentation engine.

 ====================================
 Discussion on Article: Scheduling Disk Defragmenter in Windows XP

You don't need to create a batch file, just create a scheduled task that has a run line like:
C:\WINDOWS\system32\defrag.exe c: -v>>C:\logs\defrag.log
http://techrepublic.com.com/5206-6230-0.html?forumID=5&threadID=195864&start=0
=======================================================
http://www.derkeiler.com/Mailing-Lists/securityfocus/focus-ms/2002-08/0077.html
-------------------------------------------------------------------------------------
risks posed by running task sched  manager on client  server
http://www.derkeiler.com/Mailing-Lists/securityfocus/focus-ms/2002-08/0077.html
ASKER CERTIFIED SOLUTION
Avatar of Kenneniah
Kenneniah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rj22

ASKER

Excellent idea!  Thanks much.