PowerShell Cmdlets for Export Rules

Prev Next

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.

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.

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:

$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.

Get-CUScheduledExportRules

Lists all export rules.

Syntax

Get-CUScheduledExportRules [[-RuleId] <string>] [[-View] {Folders | Hosts | Machines | Sessions | Processes | Accounts | Applications}] [<CommonParameters>]

Input Parameters

Parameter

Description

Mandatory

Possible Values

RuleId

Rule GUID

No

View

Available view

No

  • Folders

  • Hosts

  • Machines

  • Sessions

  • Processes

  • Accounts

  • Applications

Examples

Get-CUScheduledExportRules

Lists all configured export rules.
Powershell window displaying Get-CUScheduledExportRules cmdlet output results

Get-CUScheduledExportRules -View Machines

Lists all export rules for the Machines view

Add-CUScheduledExportRule

Creates a new export rule (for monitor only). The user that runs the action needs the Manage Monitors permission in the Security Policy.

Syntax

Add-CUScheduledExportRule [-View] <PsExportRuleView> [-Days] <DayOfWeek[]> [-StartTime] <TimeSpan> [-EndTime] <TimeSpan> [-Interval] <TimeSpan> [[-DeleteOlderThan] <TimeSpan?>] [[-IncludeAssociations] <SwitchParameter>] [<CommonParameters>]

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

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

Set-CUScheduledExportRule

Edits an existing export rule.

Syntax

Set-CUScheduledExportRule [-RuleId] <String> [[-View] <PsExportRuleView>] [[-Days] <DayOfWeek[]>] [[-StartTime] <TimeSpan>] [[-EndTime] <TimeSpan>] [[-Interval] <TimeSpan>] [[-DeleteOlderThan] <TimeSpan?>] [[-IncludeAssociations] <Boolean>] [<CommonParameters>]

Input Parameters

See input parameters for Add-CUScheduledExportRule

Examples

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

Remove-CUScheduledExportRule [-RuleId] <String> [[-Force] <SwitchParameter>] [<CommonParameters>]

Input Parameters

Parameter

Description

Mandatory

Possible Values

RuleId

Rule GUID

Yes

Force

If used, no confirmation prompt is shown

No

Examples

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