index > Architecture, Tools, and Process for ISVs > Running script

Running script


Hello not sure in what forum to ask this question but I was wondering if it is possible for the task scheduler in windows xp professional to do something while no one is logged on to the comuter?
AndersBank

Yes, but the right choice depends on what "something", what tool you use to write your script as well as your requirements for flexibility, security etc. To run a task on a Windows machine without anybody being logged on, you must run as a service and you have 2 main options:

a) Use the built in "Task Scheduler" service. That service can schedule and execute commands (such as a VB script, exe-files etc). It runs in a shared service process (svchost.exe) by default under the "Local System" account, which means it can do almost anything on the local machine, but nothing on the network or remotre machines.

b) Program your own service. You can easilly do this using Visual Studio and .NET since there's a project template and a service installer that hides all the dirty details about creating and installing the service so you can focus on the service logic. This option gives you almost unlimited control over the programming logic as well as the security settings (your service runs under an account of your choice and your service can do whatever you allow that account to do)




This posting is provided "AS IS" with no warranties, and confers no rights. MTC ISV Team [MSFT]
Michel Baladi
Great thanks for your answer! Do you have any tips on links that tells you how to write an easy script for the task scheduler? Thanks!!
AndersBank

To schedule a task use, the "AT" command from the command line. Type AT /? to get help on how to shedule commands, list scheduled commands etc. You can also programatically configure the task scheduler. A lot of info is available here http://msdn.microsoft.com/library/en-us/taskschd/taskschd/task_scheduler_start_page.asp

The command itself can be a Windows command (such as xcopy), an application (such as ntbackup) or a script you write in Visual Basic Script or a CMD file (in the future there will also be a new PowerShell available with Windows). It can also be a command line application that you write using .NET (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaa/html/getstart_vcsharp.asp).

For the task to run when no user is logged on, the above commands must obvoiusly not be interactive (i.e. not pop up a dialog and ask for user input). Many commands and applications take responses as parametered input or work with response files.

There's a lot of info and samples on how to write scripts available at http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx




This posting is provided "AS IS" with no warranties, and confers no rights. MTC ISV Team [MSFT]
Michel Baladi
Thank you very much for your answers. However I just heard that there was something called Task Scheduler but I do not where on the computer that you can find it. I found something in the Control Panel called Scheduled Activities but I suppose that refers to the task already created. Where can you find the Task Scheduler? Thanks again!
AndersBank

From GUI:
Goto Control Panel - (Performance & Maintenance if you use category view) - Administrative Tools - Services. It is listed here under the name "Task Scheduler". Here you can start/stop/configure the services, but not schedule tasks.

From CMD:
Start (is started by default): net start schedule
Stop: net stop schedule
List tasks: at
Add a simple task to run at 12 every mon & tue: at 12:00 /every:m,t mycommands.cmd
Delete a task with id 2: at 2 /delete




This posting is provided "AS IS" with no warranties, and confers no rights. MTC ISV Team [MSFT]
Michel Baladi
reply 6

You can use google to search for other answers

 

More Articles

• Assigning new series to chart
• WMI.Net 2.0
• The official welcome post
• Independent. Sure, but at any price?
• Does anyone know some good places to look for Architects
• Architecture - what it is and what it will be
• Backup and Restore Data/Metadata for a Novel Backend.
• So Software as a Service is the next big thing ??again?
• Gantt Chart component/library
• implemnting cache in best possible way
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• Assigning new series to chart
• Introducing our newest forum!
• Architecture for the Download and Instal
• Backup and Restore Data/Metadata for a N
• how to show wcf proxy's datasets to the
• Data access layer generating software ap
• Independent. Sure, but at any price?
• WMI.Net 2.0
• implemnting cache in best possible way
• Gantt Chart component/library
• Running script
• Architecture - what it is and what it wi
• Does anyone know some good places to loo
• So Software as a Service is the next big
• The official welcome post

Hot Articles

• Assigning new series to chart
• Architecture for the Download and Instal
• Introducing our newest forum!
• Data access layer generating software ap
• Gantt Chart component/library
• The official welcome post
• Backup and Restore Data/Metadata for a N
• So Software as a Service is the next big
• Independent. Sure, but at any price?
• implemnting cache in best possible way
• Running script
• Does anyone know some good places to loo
• how to show wcf proxy's datasets to the
• Architecture - what it is and what it wi
• WMI.Net 2.0

Recommend Articles

• Gantt Chart component/library
• Running script
• Data access layer generating software ap
• WMI.Net 2.0
• Does anyone know some good places to loo
• Architecture for the Download and Instal
• Architecture - what it is and what it wi
• Backup and Restore Data/Metadata for a N
• how to show wcf proxy's datasets to the
• The official welcome post
• Introducing our newest forum!
• So Software as a Service is the next big
• Independent. Sure, but at any price?
• Assigning new series to chart
• implemnting cache in best possible way