Solved

Programically controlling advanced settings for schtasks.exe

Posted on 2006-06-25
6
2,519 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 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Migration of Exchange mailbox can be done with the ExProfre.exe tool. But at times, when the ExProfre.exe tool migrates the Exchange Server user profile, it results in numerous synchronization problems. Synchronization error messages appear in the e…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now