I want to create PowerShell scripts to override some parameter of my monitor and rule. I used the below code, but I have some errors. I want override my overidable parameter not enabled or something else. How can I doe this?
$mps = Get-SCOMManagementPack | ? {$_.Name -like "test"}
$overrideMp = Get-SCOMManagementPack -DisplayName "Overrides"
$overridename = "testmonitor.Overrides"
$monitor = 'testmonitor'
$override = New-Object Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitorPropertyOverride($overrideMp,$overridename)
$override.Monitor = $monitor
$override.Property = 'WarningThreshold'
$override.Value = 80
$override.DisplayName = "Overrides"
$overrideMp.Verify()
$overrideMp.AcceptChanges()
Errors:
error1: Exception setting "Property": "Cannot convert value "WarningThreshold" to type "Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitorProperty". Error: "Unable to match the identifier name WarningThreshold to a valid enumerator name. Specify one of the following enumerator names and try again: Enabled, TraceEnabled, Algorithm, AlgorithmPercentage, DefaultState, GenerateAlert, AutoResolve, AlertPriority, AlertOnState, AlertSeverity, AlertMessage, AlertParameter1, AlertParameter2, AlertParameter3, AlertParameter4, AlertParameter5, AlertParameter6, AlertParameter7, AlertParameter8, AlertParameter9, AlertParameter10, MemberInMaintenance, MemberUnavailable, IgnoreMemberInMaintenance, IgnoreMemberUnavailable"" At line:1 char:2 + $override.Property = $parametername + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], SetValueInvocationException + FullyQualifiedErrorId : ExceptionWhenSetting
error2 : Exception calling "AcceptChanges" with "0" argument(s): "Database error. MPInfra_p_ManagementPackInstall failed with exception: Failed to validate item: testrule1" At line:193 char:1 + $MP.AcceptChanges() + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ManagementPackException