Ryan Anderson's ConfigMgr Blog

Premier Field Engineer for System Center Configuration Manager

Scheduling ConfigMgr reports to run using non-static dates

Scheduling ConfigMgr reports to run using non-static dates

  • Comments 4
  • Likes

You’ll notice that when you create a subscription for a report that requires date parameters in the Configuration Manager console that you can only select a static date range.

 

CMConsoleSubscription

 

Typically when you are setting up a subscription, you want the report to run for a date range relative to when it is being delivered. For example, when you setup a daily subscription, you would want to use a date range since yesterday as that’d be the last time that you received the report.

 

You can easily do this using the report's default dates. Depending on your needs, you can also modify the default dates for existing or custom reports.

 

In this example, I’m using the built in Endpoint Protection “Infected Computers” report.

  • Connect to your Reporting Services Point http://SiteServer/Reports, open your reports directory (ConfigMgr_XXX where XXX is your site code), and open the Endpoint Protection folder
  • Hover your mouse over the “Infected Computers” report, click the down arrow, and select Subscribe

Note the Use Default options for the start and end date:

clip_image002


The default start and end dates for this report is currently set to a week of data. You can setup your report with the above options, and you’ll get a current weeks worth of data every time the report is delivered.

 

Let’s say that you want to change this to deliver one days worth of data. To do so, you’d need to edit the existing report with Report Builder. For more information about using Report Builder, you can go here.

 

Note: Any time you are making modifications to reports, you should keep the original and save the custom one with a new name.

 

To edit an existing report, you simply right click the report in the ConfigMgr console and select Edit.

EditReport

 

This will open the report in report builder.

 

To modify the default values for the “Infected Computers” report to daily, you’d do the following:

  • Right click on the report from the console and select edit to launch Report Builder
  • Expand Datasets, right click StartEndDates and select Dataset Properties
  • In the query field, you’ll see the following:
    select DATEADD(day,-7,DATEDIFF(day, 0, GetUTCDate())) as StartDate, DATEADD(day,0,DATEDIFF(day, 0, GetUTCDate())) as EndDate
  • Modify the highlighted 7 above to a 1 to modify the default to run since yesterday rather than for the last week, and click okay
  • See Below

ModifyDataSet

 

To Save the report:

  • Click the circle at the top left of report builder and select Save As
    • Some built-in reports have sub-reports or drill down reports that are in the same folder. If you move to a different folder, you may break those links.
  • Modify the existing name to something like “Custom-Infected computers-DefaultYesterday” to ensure that you don't modify the default report.

 

Now when you go back to the report to setup a subscription, you’ll see that the default start date is now yesterday rather than last week:

clip_image002[4]

 

Enjoy!

Ryan

Comments
  • Greate

  • Great work Ryan, this helped a lot!

  • Thanks guys!

  • My report doesn't have the "Use Default" option?!

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment