Change the SCOM 2012 Database Grooming Settings using PowerShell

If you want to use PowerShell to change the Database Grooming settings in SCOM 2012, you can use the following: (just set the value to how many days you want to keep the data before grooming it out of the database)

# The number of days before grooming resolved alerts
Set-SCOMDatabaseGroomingSetting -AlertDaysToKeep 2
# The number of days before grooming availability history
Set-SCOMDatabaseGroomingSetting -AvailabilityHistoryDaysToKeep 2
# The number of days before grooming event data
Set-SCOMDatabaseGroomingSetting -EventDaysToKeep 1
# The number of days before grooming task history
Set-SCOMDatabaseGroomingSetting -JobStatusDaysToKeep 2
# The number of days before grooming maintenance mode history
Set-SCOMDatabaseGroomingSetting -MaintenanceModeHistoryDaysToKeep 2
# The number of days before grooming monitoring job data
Set-SCOMDatabaseGroomingSetting -MonitoringJobDaysToKeep 2
# The number of days before grooming performance data
Set-SCOMDatabaseGroomingSetting -PerformanceDataDaysToKeep 2
# The number of days before grooming state change data
Set-SCOMDatabaseGroomingSetting -StateChangeEventDaysToKeep 4

# Loading the Old 2007 R2 Provider to finish the configuration of things that cannot be done with the new cmdlets

add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”
new-managementGroupConnection -ConnectionString:YOURMANAGEMENTSERVERHERE
set-location “OperationsManagerMonitoring::”
Set-DefaultSetting -Name ManagementGroupPartitioningAndGroomingSettingsPerformanceSignatureDaysToKeep -Value 1
Set-DefaultSetting -Name ManagementGroupPartitioningAndGroomingSettingsJobStatusDaysToKeep -Value 1

Advertisements
This entry was posted in Powershell for SCOM, SCOM 2012 SP1 and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s