Share via

Script for collecting data from SCOM

Foboss 1 Reputation point
2022-07-14T04:13:32.677+00:00

Hello everyone
Please tell me which script to write in PowerShell in order to unload all alerts from SCOM for the last 100 days with monitors and rules?

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

1 answer

Sort by: Most helpful
  1. Limitless Technology 40,106 Reputation points
    2022-07-15T07:12:10.027+00:00

    Hi there,

    Found this script in an forum and seems promising for fetching the datas.

    Load the MOMScript API and the PropertBag provider

    $API = New-Object -comObject "MOM.ScriptAPI"
    $bag = $api.CreatePropertyBag()

    Main script

    $TempCount = (Get-ChildItem C:\Windows\Temp).Count

    Add the data into the PropertyBag

    $bag.AddValue("FilesInTemp",$TempCount)

    Output the PropertyBag data for SCOM consumption:

    $bag

    Collecting SCOM Data Using REST APIs or Powershell or SQL

    https://social.technet.microsoft.com/Forums/en-US/00af3520-dd08-47e7-97fd-90a7c265b4ee/collecting-scom-data-using-rest-apis-or-powershell-or-sql?forum=operationsmanager


    --If the reply is helpful, please Upvote and Accept it as an answer–

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.