Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

Updating MP name in alert custom field

$
0
0

Hi All,

We are trying to update the custom alert field with MP name

with the below modified script. On some of the alerts we are able to update but its not working smoothly on all the alerts as per the critieria set.


Import-Module OperationsManager
New-SCOMManagementGroupConnection

$alerts = Get-SCOMAlert | where {$_.ResolutionState -eq "0" -and $_.Severity -eq "2"}
 
foreach ($alert in $alerts)
{
   $alert.CustomField1 = $alert.NetBiosComputerName
  $alert.CustomField2 = $alert.Severity 
  $alert.ResolutionState = "5" 
  if ($alert.IsMonitorAlert -like 'False') 
  { 
      $alert.CustomField3 = 
((get-SCOMrule $alert.monitoringruleid).getmanagementpack()).displayname
  } 
  else 
  { 
      $alert.CustomField3 = (
get-SCOMmonitor $alert.monitoringruleid).getmanagementpack().displayname 
  } 
  $alert.Update("Filling the CustomFields") 




exit

Any inputs to make it work for all the alerts

Any better solution available with anyone.

Thanks

Sunil

Sunil Mittal <sunil.mittal623@gmail.com>

9:27 PM (1 hour ago)
to manish
Import-Module OperationsManager
New-SCOMManagementGroupConnection

$alerts = Get-SCOMAlert | where {$_.ResolutionState -eq "0" -and $_.Severity -eq "2"}
 
foreach ($alert in $alerts)
{
   $alert.CustomField1 = $alert.NetBiosComputerName
  $alert.CustomField2 = $alert.Severity 
  $alert.ResolutionState = "5" 
  if ($alert.IsMonitorAlert -like 'False') 
  { 
      $alert.CustomField3 = 
((get-SCOMrule $alert.monitoringruleid).getmanagementpack()).displayname
  } 
  else 
  { 
      $alert.CustomField3 = (
get-SCOMmonitor $alert.monitoringruleid).getmanagementpack().displayname 
  } 
  $alert.Update("Filling the CustomFields") 



exit

Sunil Mittal <sunil.mittal623@gmail.com>

9:27 PM (1 hour ago)
to manish
Import-Module OperationsManager
New-SCOMManagementGroupConnection

$alerts = Get-SCOMAlert | where {$_.ResolutionState -eq "0" -and $_.Severity -eq "2"}
 
foreach ($alert in $alerts)
{
   $alert.CustomField1 = $alert.NetBiosComputerName
  $alert.CustomField2 = $alert.Severity 
  $alert.ResolutionState = "5" 
  if ($alert.IsMonitorAlert -like 'False') 
  { 
      $alert.CustomField3 = 
((get-SCOMrule $alert.monitoringruleid).getmanagementpack()).displayname
  } 
  else 
  { 
      $alert.CustomField3 = (
get-SCOMmonitor $alert.monitoringruleid).getmanagementpack().displayname 
  } 
  $alert.Update("Filling the CustomFields") 



exit


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>