The following script can be used to automatically export a Datamining Report as a CSV file into a predefined folder on the server on a schedule.
Method:
- Create and save the Datamining Report
- Make a note of it's ID
- Create a folder on the ManagementStudio IIS server when the report will be saved (the ManagementStudio service account must have the permissions to create files in this folder)
- Navigate to Administration -> [Module where report was created] -> PowerShell Scripts
- Select the [Module] node
- Click here to add new item
- Give the script a name and description
- Use the Grid Column Chooser button (next to the Pivot button) to show the Grant Access 2 column
- Change Grant Access 2 to Project Admins
- Click the Edit button
- Replace the default contents with the script below
$DMR_IDS = @(123) $EXPORT_LOCATION = "c:\DMR_Export" ForEach($dmrId in $DMR_IDS) { $rpt = Get-MSDataminingReportById -ReportId $dmrId -HeaderFormat DisplayName $outFile = $EXPORT_LOCATION + "\" + $rpt.Status.ReportName + ".csv" $rpt.Data | Export-Csv $outFile -NoTypeInformation -Encoding UTF8 }
- Modify line 1 to use the ID of the saved report (note that multiple IDs can be added as a comma-separated list)
- Modify line 2 to use the folder where the report should be saved
- Click Save Changes
- Click the Run button
- The report will be created in the export location
- Finally set a schedule in the Schedule 1 column and click Save Changes