Solved

Programically controlling advanced settings for schtasks.exe

Posted on 2006-06-25
6
2,600 Views
Last Modified: 2010-05-18
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>

0
Comment
Question by:rj22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:esromneb
ID: 16978390
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?
0
 
LVL 70

Expert Comment

by:Merete
ID: 16981532
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
0
 
LVL 24

Accepted Solution

by:
Kenneniah earned 125 total points
ID: 16987662
Since schtasks does not have those options, create the task first using the gui in control panel.
Then to deploy, just copy the .job file from C:\WINDOWS\Tasks and push it out to C:\WINDOWS\Tasks using whatever method you prefer.
The .job file copy method does not retain having the task run under the system account, so if you need that function, after pushing the .job file, have it run...

SCHTASKS /CHANGE /RU "NT AUthority\System" /TN "Yourtaskname"
0
 

Author Comment

by:rj22
ID: 16988576
Excellent idea!  Thanks much.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question