Share via


Creating a task for File Server Resource Manager reports by using the schtasks command

 

Applies To: Windows Server 2008, Windows Server 2008 R2

Before you can schedule a storage report by using the Storrept command-line tool for File Server Resource Manager, you must first create a task on the computer that will be generating the report. You can create this task by using the schtasks command, which is available by default in Windows Server 2008.

This topic explains how to create a task that can be used to schedule a File Server Resource Manager storage report. For an example of how to use the schtasks and storrept commands to schedule a storage report task, see Example.

About the schtasks command

The schtasks command helps you create and manage common tasks that your computer will carry out automatically at the times that you specify. Using schtasks, you can schedule programs and other commands to run periodically or at a specific time. Note that this command-line tool performs the same operations as Task Scheduler in Administrative Tools.

For more information about the schtasks command, see Schtasks.

Creating a task to generate a storage report

You can create new tasks by using the /create parameter with the schtasks command.

To perform this procedure, you must have membership in Administrators, or you must have been delegated the appropriate authority.

To create a task that generates a storage report

  1. Open an elevated Command Prompt window. (Click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.)

  2. To create the new task, type:

    schtasks /create /sc <Schedule> /tn <TaskName> /tr "storrept reports generate /scheduled /task:<TaskName>" /v1 /st <Time> /ru system

    where:

    • Schedule specifies the schedule type. Valid values are minute, hourly, daily, weekly, monthly, once, onstart, onlogon, and onidle. For more information about these values, see Schtasks.

    • TaskName is the name that you want to give the task. Each task on the system must have a unique name. Use quotation marks to enclose names that include spaces.

    • Time specifies the time of day at which you want the report to be generated. The time format is based on 24-hour time (hh:mm). For example, type 14:30 if you want the report to be generated at 2:30 p.m.. If you do not use the /st parameter, the current time will be used for the scheduling of the task.

Important

You must include both the /scheduled parameter for the storrept command and the /v1 parameter for the schtasks command. Without these parameters, the storage report task will not run successfully.

Note

When specifying a time for the task to run, consider choosing a time of day when your server is less busy. This will ensure minimal impact on system performance.

Note

There are other optional parameters that you can use with the /create parameter of the schtasks command. Those parameters enable you to create more complex schedules and manage how the storage report task will run. For more information, see Schtasks.

Adding a storage report to a scheduled task

After the task has been successfully created, you can use the Storrept reports add command to specify the report that will be generated when the scheduled task runs. You can also use the Storrept reports modify command to add more than one report to the same task.

Example

To create a new task named FSRMReport that will run daily at 1:00 a.m., type:

schtasks /create /sc daily /tn fsrmreport /tr "storrept reports generate /scheduled /task:fsrmreport" /v1 /st 01:00 /ru system

After the FSRMReport task has been successfully created, to add to the task a Quota Usage report for volumes C: and D: in HTML format, and have the report sent to the admin@contoso.com and storage.quota@contoso.com e-mail addresses, type:

storrept reports add /task:fsrmreport /scope:"c:\|d:\" /add-report:quotausage /format:"html" /mailto:admin@contoso.com;storage.quota@contoso.com

To add the File Screen Auditing report to the same FSRMReport task so that both this report and the Quota Usage report are generated when the task runs, type:

storrept reports modify /task:fsrmreport /add-report:filescreenaudit