Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Programically controlling advanced settings for schtasks.exe

Posted on 2006-06-25
6
Medium Priority
?
2,638 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
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 500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article (http://rdsrc.us/u3GP7A) first and run the tool TDSSKiller (http://rdsrc.us/GDBBs4) to get rid of the infection. Once done, and if the …
We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
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…
Suggested Courses

885 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