This page refers to an older version of the product.
View the current version of the User Help.

Scheduled Maintenance Cmdlets

The following are the lists of commands to schedule event maintenance.

Arguments in bold are mandatory.

Disable-AmcSchedule

Disables a maintenance schedule.

Return value: Void

Arguments Argument Description
JobId (String) Numeric identifier for the job to disable.

Enable-AmcSchedule

Enables a maintenance schedule.

Return Value: Void

Arguments Argument Description
JobId (String) Numeric identifier for the job to enable.

Get-AmcSchedule

Retrieves a single scheduled maintenance from a JobId.

Return Value: MaintenanceHelper.SchedulesDto

Arguments Argument Description
JobId (String) Numeric identifier for the job to retrieve.

Invoke-AmcRemoveEventsFromDeploymentGroup

Deletes the events from the specified Deployment Group.

The invoke schedule creates a temporary schedule, of the type specified, that runs immediately and then deletes itself.

Return Value: Void

Arguments Argument Description
GroupName (String) The name of the deployment group from which the events are to be removed.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Invoke-AmcRemoveEventsOlderThan

Deletes the events that are older than the number of days specified.

The invoke schedule creates a temporary schedule, of the type specified, that runs immediately and then deletes itself.

Return Value: Void

Arguments Argument Description
Days (String) The number of days worth of events to retain, any events older than this will be deleted.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Invoke-AmcRemoveEventsWithId

Deletes the events with the specified Id.

The invoke schedule creates a temporary schedule, of the type specified, that runs immediately and then deletes itself.

Return Value: Void

Arguments Argument Description
EventId (String) The event Id to be removed from the database.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Invoke-AmcRemoveEventsWithIdRange

Deletes all events within an event Id range.

The invoke schedule creates a temporary schedule, of the type specified, that runs immediately and then deletes itself.

Return Value: Void

Arguments Argument Description
End Event Id (String) The event Id at the end of the range.

Start Event Id

The event Id at the start of the range.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Invoke-AmcRemovehighVolumeEventsOlderThan

Deletes all high volume events older than the specified number of days.

The invoke schedule creates a temporary schedule, of the type specified, that runs immediately and then deletes itself.

Return Value: Void

Arguments Argument Description
Days (String) The maximum age of high volume events that should be retained.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Invoke-AmcRemoveOrphanedAlerts

Deletes all alerts which do not have any associated events.

The invoke schedule creates a temporary schedule, of the type specified, that runs immediately and then deletes itself.

Return Value: Void

Arguments Argument Description

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Remove-AmcSchedule

Remove a schedule with the specified job Id.

Return value: Void

Arguments Argument Description
JobId (String) Numeric identifier for the job to delete, as indicated by Get-AmcSchedules

Set-AmcEncryptionKeyHash

Generates the AMC encryption key hash. The hash is used to monitor the encryption key used to store the credentials in the database.

Return Value: Void

Arguments Argument Description
Configurer Credential The credentials that the cmdlet uses to make changes to the database. If this parameter is omitted then the cmdlet uses the user's credential.
Configurer Sql Authentication (Switch) When this switch is specified then the credentials provided by Configurer Credential are defined as SQL Authentication credentials. If this parameter is omitted then the Configurer Credential is presumed to be Windows credentials.
Database Server The SQL server hosting the database.
Database Name The name of the database on the SQL server.

Stop-AmcSchedule

Cancels the specified schedule.

Return Value: Void

Arguments Argument Description
JobId (String) Numeric identifier for the job to be canceled.

New-AmcScheduleRemoveEventsFromDeploymentGroup

Adds a new schedule to delete events from the specified deployment group on the specified day each week.

Return value: Void

Arguments Argument Description
GroupName (String) The name of the deployment group from which the events are to be removed.
Description (String) Free text field for the administrator to specify the purpose of this scheduled entry, or any other details of their choosing.
DayOfWeek (DayOfWeek) The day each week that the action should be carried out. Its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).
StartTimeInUTC (String) A string representing the UTC time of day that the requested action should begin. Must be parsable into a .Net System.DateTime value.
MaxRunHours (Int) How long the action should run. Even if the job is late in being started (e.g. machine is powered off), the finish time is always StartTimeInUTC + MaxRunHours.
BatchSize (Int) Number of rows to be affected within each batch transaction.
BatchDelay (TimeSpan) Amount of time in seconds that SQL will pause to allow other transactions to process so preventing transaction locks.

New-AmcScheduleRemoveEventsOlderThan

Adds a new schedule to delete events that are older than the number of days specified.

Return value: Void

Arguments

Argument Description

Days (Int)

The maximum age of events that should be retained.

Description (String)

Free text field for the administrator to specify the purpose of this scheduled entry, or any other details of their choosing.

DayOfWeek (DayOfWeek)

The day each week that the action should be carried out. Its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

StartTimeInUTC (String)

A string representing the UTC time of day that the requested action should begin. Must be parsable into a .Net System.DateTime value.

MaxRunHours (Int)

How long the action should run. Even if the job is late in being started (e.g. machine is powered off), the finish time is always StartTimeInUTC + MaxRunHours.

BatchSize (Int)

Number of rows to be affected within each batch transaction.

BatchDelay (TimeSpan)

Amount of time in seconds that SQL will pause to allow other transactions to process so preventing transaction locks.

New-AmcScheduleRemoveEventsWithId

Creates a job schedule entry to delete all events with the specified ID.

Return value: Void

Arguments Argument Description
EventId (Int) The Event Log numeric identifier for the events that are to be deleted
Description (String) Free text field for the administrator to specify the purpose of this scheduled entry, or any other details of their choosing.
DayOfWeek (DayOfWeek) The day each week that the action should be carried out. Its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).
StartTimeInUTC (String) A string representing the UTC time of day that the requested action should begin. Must be parsable into a .Net System.DateTime value.
MaxRunHours (Int) How long the action should run. Even if the job is late in being started (e.g. machine is powered off), the finish time is always StartTimeInUTC + MaxRunHours.
BatchSize (Int) Number of rows to be affected within each batch transaction.
BatchDelay (TimeSpan) Amount of time in seconds that SQL will pause to allow other transactions to process so preventing transaction locks.

New-AmcScheduleRemoveEventsWithIdRange

Adds a new schedule to delete events in a particular range of values from all deployment groups on the specified day each week.

Return value: Void

Arguments Argument Description
StartEventId (Int) The Event Log numeric identifier for the start of the range of values to be deleted.
EndEventId (Int) The Event Log numeric identifier for the end of the range of values to be deleted.
Description (String) Free text field for the administrator to specify the purpose of this scheduled entry, or any other details of their choosing.
DayOfWeek (DayOfWeek) The day each week that the action should be carried out. Its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).
StartTimeInUTC (String) A string representing the UTC time of day that the requested action should begin. Must be parsable into a .Net System.DateTime value.
MaxRunHours (Int) How long the action should run. Even if the job is late in being started (e.g. machine is powered off), the finish time is always StartTimeInUTC + MaxRunHours.
BatchSize (Int) Number of rows to be affected within each batch transaction.
BatchDelay (TimeSpan) Amount of time in seconds that SQL will pause to allow other transactions to process so preventing transaction locks.

New-AmcScheduleRemoveHighVolumeEventsOlderThan

Adds a new schedule to delete all high volume events that are older than the number of days specified.

Return value: Void

Arguments

Argument Description

Days (Int)

The maximum age of events that should be retained.

Description (String)

Free text field for the administrator to specify the purpose of this scheduled entry, or any other details of their choosing.

DayOfWeek (DayOfWeek)

The day each week that the action should be carried out. Its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

StartTimeInUTC (String)

A string representing the UTC time of day that the requested action should begin. Must be parsable into a .Net System.DateTime value.

MaxRunHours (Int)

How long the action should run. Even if the job is late in being started (e.g. machine is powered off), the finish time is always StartTimeInUTC + MaxRunHours.

BatchSize (Int)

Number of rows to be affected within each batch transaction.

BatchDelay (TimeSpan)

Amount of time in seconds that SQL will pause to allow other transactions to process so preventing transaction locks.

New-AmcScheduleRemoveOrphanedAlerts

Adds a new schedule to delete all alerts which do not have any associated events.

Return value: Void

Arguments Argument Description
Description (String) Free text field for the administrator to specify the purpose of this scheduled entry, or any other details of their choosing.
DayOfWeek (DayOfWeek) The day each week that the action should be carried out. Its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).
StartTimeInUTC (String) A string representing the UTC time of day that the requested action should begin. Must be parsable into a .Net System.DateTime value.
MaxRunHours (Int) How long the action should run. Even if the job is late in being started (e.g. machine is powered off), the finish time is always StartTimeInUTC + MaxRunHours.
BatchSize (Int) Number of rows to be affected within each batch transaction.
BatchDelay (TimeSpan) Amount of time in seconds that SQL will pause to allow other transactions to process so preventing transaction locks.

Publish-AmcEncryptionKey

The AMC uses an encryption key to safely store sensitive information such as client access credentials in the AMC database. For multiple servers to read from the same database this key needs to be synchronized.

This command pushes the local AMC encryption key to the connected database for other Management Servers to sync with.

You can sync with this key on other servers using the Sync-AmcEncryptionKey command. This is encrypted with the provided parameter and stored in the database. This should be removed using the Unpublish-AmcEncryptionKey when all servers are in sync.

Return Value: Void

Arguments Argument Description
Password (String) Password is used to secure the credential while it is stored in the database. You will need the same password to retrieve the key to another server.
Secure Password (String) Password is used to secure the credential while it is stored in the database. You will need the same password to retrieve the key to another server.
Configurer Credential The credentials that the cmdlet uses to make changes to the database. If this parameter is omitted then the cmdlet uses the user's credential.
Configurer Sql Authentication (Switch) When this switch is specified then the credentials provided by Configurer Credential are defined as SQL Authentication credentials. If this parameter is omitted then the Configurer Credential is presumed to be Windows credentials.
Database Server The SQL server hosting the database.
Database Name The name of the database on the SQL server.

Sync-AmcEncryptionKey

The AMC uses an encryption key to safely store sensitive information such as client access credentials in the AMC database. For multiple servers to read from the same database this key needs to be synchronized.

This command pulls a stored encryption key from an AMC database and uses it on the local server. You can publish a key from another server using the Publish-AmcEncryptionKey command. The key should be removed using the Unpublish-AmcEncryptionKey when all servers are in sync.

Return Value: Void

Arguments Argument Description
Password (String) Password is used to read the encrypted key from the database. You will need to use the same password that was used in the Publish command.
Secure Password (String) Password is used to read the encrypted key from the database. You will need to use the same password that was used in the Publish command.
Configurer Credential The credentials that the cmdlet uses to make changes to the database. If this parameter is omitted then the cmdlet uses the user's credential.
Configurer Sql Authentication (Switch) When this switch is specified then the credentials provided by Configurer Credential are defined as SQL Authentication credentials. If this parameter is omitted then the Configurer Credential is presumed to be Windows credentials.
Database Server The SQL server hosting the database.
Database Name The name of the database on the SQL server.

Unpublish-AmcEncyptionKey

The AMC uses an encryption key to safely store sensitive information such as client access credentials in the AMC database. For multiple servers to read from the same database this key needs to be synchronized.

This command removes the AMC encryption key from the connected database after other Management Servers are in sync. The key will still be stored securely on each serer but will no longer be in the database.

Return Value: Void

Arguments Argument Description
Configurer Credential The credentials that the cmdlet uses to make changes to the database. If this parameter is omitted then the cmdlet uses the user's credential.
Configurer Sql Authentication (Switch) When this switch is specified then the credentials provided by Configurer Credential are defined as SQL Authentication credentials. If this parameter is omitted then the Configurer Credential is presumed to be Windows credentials.
Database Server The SQL server hosting the database.
Database Name The name of the database on the SQL server.

Test-AmcEncryptionKey

The AMC uses an encryption key to safely store sensitive information such as client access credentials in the AMC database. For multiple servers to read from the same database this key needs to be synchronized.

A key can be stored in the database while synchronizing all servers. This command will test to see if there is a key available.

Return Value: Void

Arguments Argument Description
Configurer Credential The credentials that the cmdlet uses to make changes to the database. If this parameter is omitted then the cmdlet uses the user's credential.
Configurer Sql Authentication (Switch) When this switch is specified then the credentials provided by Configurer Credential are defined as SQL Authentication credentials. If this parameter is omitted then the Configurer Credential is presumed to be Windows credentials.
Database Server The SQL server hosting the database.
Database Name The name of the database on the SQL server.

Test-AmcEncryptionKeyHash

Compares the hash with the encryption key. If the hash does not exist then it is created. If the command returns false then the encryption key has changed and the client credentials stored in the database will be available.

Return Value: Void

Arguments Argument Description
Configurer Credential The credentials that the cmdlet uses to make changes to the database. If this parameter is omitted then the cmdlet uses the user's credential.
Configurer Sql Authentication (Switch) When this switch is specified then the credentials provided by Configurer Credential are defined as SQL Authentication credentials. If this parameter is omitted then the Configurer Credential is presumed to be Windows credentials.
Database Server The SQL server hosting the database.
Database Name The name of the database on the SQL server.

Test-AmcRemoveEventsFromDeploymentGroup

Returns the number of events to be removed from the specified deployment group.

Return Value: Void

Arguments Argument Description

Group Name (String)

Name of the deployment group where the events are to be removed.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Test-AmcRemoveEventsOlderThan

Returns the number of events to be removed that are older than the number of days specified.

Return Value: Void

Arguments Argument Description

Days (String)

Number of days worth of events to retain, any events older than this will be deleted.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Test-AmcRemoveEventsWithId

Returns the number of events to be removed with the specified Id.

Return Value: Void

Arguments Argument Description

Event Id(String)

Event Id to be removed from the database.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Test-AmcRemoveEventsWithIdRange

Returns the number of events to be removed that are within an event Id range.

Return Value: Void

Arguments Argument Description

End Event Id (String)

End event Id range to be removed from the database.

Start Event Id (String)

Start event Id range to be removed from the database.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Test-AmcRemoveHighVolumeEventsOlderThan

Returns the number of events to be removed which are high volume events older than the specified days.

Return Value: Void

Arguments Argument Description

Days (String)

Maximum age of high volume events that should be retained.

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Test-AmcRemoveOrphanedAlerts

Returns the number of alerts which do not have any associated events to be deleted.

Return Value: Void

Arguments Argument Description

BatchDelay

Amount of time in milliseconds that SQL will pause to allow transactions to process.

BatchSize

Number of rows to be affected within each batch transaction.

Update-AmcSchedule

Updates a single Scheduled Maintenance from the specified Schedule object. This object can be obtained from the Get-AmcSchedule command.

The properties that can be updated are:

  • Description
  • StartTimeInUTC
  • Parameters
  • StartDayOfWeek
  • MaxRunHours
  • BatchSize
  • BatchDelayMs

Return Value: Void

Arguments Argument Description

Schedule (MaintenanceHelper.SchedulesDto)

Schedule object which stores the parameters for the Scheduled Maintenance.