Powershell SDK

Easy Tune PRO has a Powershell SDK which makes it possible to automate common tuning activity via Powershell.

What can you do?

At present, you can apply tuning from a Tuning Pack (CSV) and capture tuning from the contents of management pack(s) as Tuning Pack from the Powershell SDK

If there is additional functionality you would like exposed via Powershell please let us know by raising a helpdesk feature request

Setting up the Powershell SDK

The Powershell SDK is a separate package from Easy Tune which needs to be downloaded and imported into PowerShell on the SCOM server using the following CMDlet:


Import-Module '.\Cookdown.EasyTune.PSModules.dll'

CMDlets

Export-SCOMTuningPack

Capture a Tuning Pack (CSV) from the contents of management pack(s) and export the resultant Tuning Pack.

Export-SCOMTuningPack
    -ManagementPacks <list>

    [-Path <string>]

    [-SetLevels <String>]

Required Parameters

-ManagementPacks

Specifies the list of management pack or management packs to capture tuning from.

Optional Parameters

-Path

Specifies the output path of the Tuning Pack file. Defaults to the name of the management pack.

-SetLevels

Allows you to add custom levels to the captured Tuning Pack (they are blank by default and will be in addition to the captured effective tuning in the management packs which is added to an auto titled level)

Set-SCOMTuning

Apply tuning from a Tuning Pack (CSV) which will be stored in a Management Pack

Set-SCOMTuning
    -Path <String>
    -Level <String>
    [-Global <Boolean>]
    [-Group <String>]
    [-ManagementPack <String>]
    [-UpdateExisting <Boolean>]

Required Parameters

-Path

Specifies the input path of the Tuning Pack.

-Level

Specifies the name of the Tuning Pack Level to set. The Tuning Pack must contain a column with this name (the column names = the Level names).

Optional Parameters

-Global

Indicates whether the overrides created should be unscoped (apply globally). Defaults to set (true) if -Group is not specified.

-Group

Specifies the display name of the group that the overrides should target.

-CreateNewManagementPack Creates a new management pack rather than updates existing one. Default behavior is to update an existing management pack and expects you to provide a management pack Name (using -ManagementPack)

-ManagementPack

Specifies the display name of the management pack to create/update. The default behavior is to update an existing management pack.

This Parameter is required unless the -CreateNewManagementPack parameter is also set, when the display name defaults to: <Override Set Filename> | Overrides | <Global or Group Name> | <Override Set Name>.

Examples

Export

Export-SCOMTuningPack -ManagementPack "Microsoft SQL Server 2017" -Path .\sql-server-2017.csv

Create a Tuning Pack at .\sql-server-2017.csv that contains all monitors and rules contained in the `Microsoft SQL Server 2017" management pack.

Edit

The file is then edited using a text editor, Excel or some other CSV editor. The default Levels in Community Store hosted Tuning Packs of ‘essential’, ‘balanced’ and ‘full’ are defined in the CSV file. An additional Level of ‘my-production’ is defined.

Question:

Can the cmdlet be used to export the contents of an existing override MP?

Yes, for example:

Export-SCOMTuningPack -Existing -ManagementPack "Microsoft SQL Server 2017 - Overrides" -Path .\sql-server-2017.csv

Set

Set-SCOMTuning -Path .\sql-server-2017.csv -Level Balanced

A new management pack is created called ‘Microsoft SQL Server 2017 | Overrides | Global | Balanced’ (default name generated by the cmdlet). The overrides contained in the MP configure Microsoft SQL Server 2017 monitors and rules to the ‘balanced’ Level of overrides contained in .\sql-server-2017.csv. The overrides are unscoped, so apply globally (all objects).

Set-SCOMTuning -Path .\sql-server-2017.csv -Level my-production -Group "SQL 2017 - Production"

A new management pack is created called ‘Microsoft SQL Server 2017 | Overrides | SQL 2017 - Production | my-production’ (default name generated by the cmdlet). The overrides contained in the MP configure Microsoft SQL Server 2017 monitors and rules to the ‘my-production’ level of overrides contained in .\sql-server-2017.csv. The overrides are scoped only to the ‘SQL 2017 - Production’ group of servers.