--- title: "Export Metrics to a CSV File with PowerShell" slug: "powershell-cmdlets-for-export-rules" description: "To interact with monitor export rules programmatically, use our ControlUp PowerShell cmdlets. " updated: 2025-07-03T11:07:43Z published: 2025-07-03T11:07:43Z canonical: "support.controlup.com/powershell-cmdlets-for-export-rules" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.controlup.com/llms.txt > Use this file to discover all available pages before exploring further. # PowerShell Cmdlets for Export Rules With export rules, the ControlUp Monitor can automatically create CSV files which contain metrics of different views, such as **Machines**, **Folders**, or **Applications**. Learn more about export rules [here](/tim-reorg/docs/export-settings). This article provides an overview of PowerShell cmdlets that you can use to interact with export rules. Deprecation of Export Rules Cmdlets in 9.1 From version **9.1**, all of the PowerShell cmdlets for export rules described in this article have been deprecated from the ControlUp.PowerShell.User module. To configure export rules use the [**Export-CUQuery** cmdlet](/v1/docs/export-cuquery). ## Import Module All PowerShell cmdlets for export rules are implemented in the ControlUp.PowerShell.User module. Before you can start using them, open a PowerShell session with administrative privileges on one of your monitor machines and execute: ```powershell $pathToUserModule = (Get-ChildItem "C:\Program Files\Smart-X\ControlUpMonitor\*ControlUp.PowerShell.User.dll" -Recurse | Sort-Object LastWriteTime -Descending)[0] Import-Module $pathToUserModule ``` ## Required User Permission The user that runs the PowerShell cmdlets needs to be assigned the **Manage Monitor** permission in the [Security Policy](/tim-reorg/docs/security-policy-pane). ## Get-CUScheduledExportRules Lists all [export rules](/tim-reorg/docs/export-settings). ### Syntax ```powershell Get-CUScheduledExportRules [[-RuleId] ] [[-View] {Folders | Hosts | Machines | Sessions | Processes | Accounts | Applications}] [] ``` ### Input Parameters | Parameter | Description | Mandatory | Possible Values | | --- | --- | --- | --- | | RuleId | Rule GUID | No | | | View | Available view | No | - Folders - Hosts - Machines - Sessions - Processes - Accounts - Applications | ### Examples ```powershell Get-CUScheduledExportRules ``` Lists all configured export rules. ![Powershell window displaying Get-CUScheduledExportRules cmdlet output results](https://cdn.document360.io/098100b7-b9da-4bea-b4b9-017140ab863e/Images/Documentation/image-R48Q8USE.png) ```powershell Get-CUScheduledExportRules -View Machines ``` Lists all export rules for the Machines view ## Add-CUScheduledExportRule Creates a new [export rule](/tim-reorg/docs/export-settings) (for monitor only). The user that runs the action needs the **Manage Monitors** permission in the Security Policy. ### Syntax ```powershell Add-CUScheduledExportRule [-View] [-Days] [-StartTime] [-EndTime] [-Interval] [[-DeleteOlderThan] ] [[-IncludeAssociations] ] [] ``` ### Input Parameters | Parameter | Description | Mandatory | Possible Values | | --- | --- | --- | --- | | View | Available view | Yes | - Folders - Hosts - Machines - Sessions - Processes - Accounts - Applications | | Days | The days of the week on which the export rule should be executed | Yes | - "0" or "Sunday" - "1" or "Monday" - etc.. | | StartTime | Time of day when the export rule should begin execution | Yes | - 8:30:00 (= 8:30 AM) - 21:00:00 (= 9:00 PM) | | EndTime | Time of day at which the export rule will stop running | Yes | - 8:30:00 (= 8:30 AM) - 21:00:00 (= 9:00 PM) | | Interval | Interval at which the export rule will run. The minimum interval is one minute and maximum is 100 000 days | Yes | - 00:30:00 (= every 30 minutes) - 03:00:00 (= every 3 hours) | | DeleteOlderThan | Retention period for historical data. The minimum setting is one 1 minute and the maximum 100 000 days | No | | | | IncludeAssociations | If specified, exports an expanded set of columns which are usually not visible in the console. These columns are mostly for internal use | No | ### Examples ```powershell Add-CUScheduledExportRule -View Applications -Days Monday,Friday -StartTime "8:30:00" -EndTime "19:30:00" -Interval "00:30:00" ``` By executing this command, a new export rule is created for the **Applications** view. The rule is set to run **every 30 minutes** on **Mondays and Fridays**, **beginning** at **8:30 AM** and **ending** at **7:30 PM** ![Powershell window displaying Add-CUScheduledExportRule cmdlet output results](https://cdn.document360.io/098100b7-b9da-4bea-b4b9-017140ab863e/Images/Documentation/image-4NHIE932.png) ## Set-CUScheduledExportRule Edits an existing export rule. ### Syntax ```powershell Set-CUScheduledExportRule [-RuleId] [[-View] ] [[-Days] ] [[-StartTime] ] [[-EndTime] ] [[-Interval] ] [[-DeleteOlderThan] ] [[-IncludeAssociations] ] [] ``` ### Input Parameters See input parameters for [Add-CUScheduledExportRule](/tim-reorg/docs/powershell-cmdlets-for-export-rules#addcuscheduledexportrule) ### Examples ```powershell Set-CUScheduledExportRule -RuleId 1b6cc94f-b7c9-4284-bdd4-0dd34af1c614 -Days Monday,Friday -StartTime "8:30:00" -EndTime "19:30:00" ``` Updates "Days", "StartTime" and "EndTime" properties while keeping all other properties unchanged. ## Remove-CUScheduledExportRule Removes an export rule. ### Syntax ```powershell Remove-CUScheduledExportRule [-RuleId] [[-Force] ] [] ``` ### Input Parameters | Parameter | Description | Mandatory | Possible Values | | --- | --- | --- | --- | | RuleId | Rule GUID | Yes | | | Force | If used, no confirmation prompt is shown | No | | ### Examples ```powershell Remove-CUScheduledExportRule -RuleId a48a0c46-6901-43ed-ac6f-69ce2a0463a8 ``` Prompts the user to confirm the deletion of Rule ID a48a0c46-6901-43ed-ac6f-69ce2a0463a8 before removing it. ![Powershell window displaying Remove-CUScheduledExportRule cmdlet with warning Prompt](https://cdn.document360.io/098100b7-b9da-4bea-b4b9-017140ab863e/Images/Documentation/image-WOKBLU3D.png)