SCOM Powershell get alert count for specific groups

Hello good people,
im looking for a powershell script (to use in powershell widget):
ive got 3 groups which generate alerts, for example group1 group2 group3
now i need to get all new alerts and closed alerts per group
groupid  new  closed
group1    12     100
group2    10       50
group3    3         6
thx for your help in advanced

you may consider using the following powershell cmdlet to count number of closed alert
$gp1closed=get-scommonitoringobject|where-object{$_.displayname -eq 'group1'} | get-scomalert | whereobject$_.resolutionstate -eq '255'} |measure
$gp1open=get-scommonitoringobject|where-object{$_.displayname -eq 'group1'} | get-scomalert | whereobject$_.resolutionstate -eq '0'} |measure
$gp2closed=get-scommonitoringobject|where-object{$_.displayname -eq 'group2'} | get-scomalert | whereobject$_.resolutionstate -eq '255'} |measure
$gp2open=get-scommonitoringobject|where-object{$_.displayname -eq 'group2'} | get-scomalert | whereobject$_.resolutionstate -eq '0'} |measure
$gp3closed=get-scommonitoringobject|where-object{$_.displayname -eq 'group3'} | get-scomalert | whereobject$_.resolutionstate -eq '255'} |measure
$gp3open=get-scommonitoringobject|where-object{$_.displayname -eq 'group3'} | get-scomalert | whereobject$_.resolutionstate -eq '0'} |measure
'Group1' + '  '+ $gp1open + '  '+ $gp1closed
'Group2' + '  '+ $gp2open + '  '+ $gp2closed
'Group3' + '  '+ $gp3open + '  '+ $gp3closed
Roger

Similar Messages

  • Is update approved for specific group via powershell?

    Hello, 
    I have a script that auto approves updates based on release date for specific groups. The script checks to see if the update has already been approved (e.g. isApproved) and either skips it if it's already been approved or approves it for my specific group
    (e.g. $update.approve("install",$wsus_group)). The problem I'm running into is if I approve Update1 for GroupA, then later check Update1's isApproved to see whether or not I need to approve it for GroupB, Update1's isApproved is $true and therefor
    my script skips approving it for GroupB. I've checked the update's object and I don't see a multi-valued var for groups that its been approved for. I've started to poke around with other
    Microsoft.UpdateServices.Administration namespaces but I don't see one that has the info I'm looking for. 
    So, how can I view what updates have been approved for GroupA vs GroupB?
    Thanks! 

    Hi Joey,
    If you want to approve updates to multiple groups, and also want to check if the updates have been approved to the groups, please check the script below:
    This can examine one computerGroup and find updates not approved for one or multiple other computer groups.
    $serverName="localhost"
    $targetComputerGroup="BaselineGroup"
    $checkForMissing="MissingGroup1,MissingGroup2"
    [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $wsus=[Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($serverName,$false)
    $computerGroup=$wsus.GetComputerTargetGroups()|ForEach-Object -Process {if ($_.Name -eq $targetComputerGroup) {$_}}
    $UpdateScope=New-Object Microsoft.UpdateServices.Administration.UpdateScope
    $UpdateScope.ApprovedStates="Any"
    $updateScope.ApprovedComputerTargetGroups.Add($computerGroup)
    $Approvals = $wsus.GetUpdateApprovals($UpdateScope)
    #At this point we have all of the updates assigned to the $targetComputerGroup
    $report= @()
    write-host "Querying for all Updates approved for $targetComputerGroup"
    foreach ($Approval in $approvals) {
    $record=""|Select-Object ComputerGroup,UpdateName, UpdateID
    $record.ComputerGroup=$wsus.GetComputerTargetGroup($Approval.ComputerTargetGroupID).Name
    $record.UpdateName=$wsus.GetUpdate($Approval.UpdateID).Title
    $record.UpdateID=$wsus.GetUpdate($Approval.UpdateID).ID.UpdateID
    $report +=$record
    #Now group the results by UpdateName
    $GR=$report|group -Property UpdateName
    $CheckForMissing=$CheckForMissing.Split(",")
    foreach ($entry in $gr) {
    $groups=@()
    foreach ($g in $entry.Group) {
    $groups += $g.ComputerGroup
    foreach ($missing in $checkForMissing) {
    if ($groups -Contains $missing) {}
    else{
    New-Object PSObject -Property @{
    Name = $entry.Name
    UpdateID = $entry.Group[0].UpdateID
    GroupMissing = $missing
    Reference from:
    WSUS report approvals for a group
    I hope this helps.

  • Get the Count for each row

    I'm trying to get the count for each row to total count for each month
    Something like this
    Hardware     |      Jan
    Monitors       |       5
    Processors   |      137
    Printers        |      57
    etc........
    How can I write a query for this. I can get the Hardware column but don't know how to get the next column.

    If you can provide more data like sample input DML statements it would have been wonderful..
    Assuming is , you need a pivot. Here is an article on basic Pivot..
    http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
    something like this may be..
    DECLARE @Input TABLE
    Hardware VARCHAR(20),
    [Date] VARCHAR(20)
    INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
    , ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
    ;WITH CTE AS
    SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
    SELECT *
    FROM
    SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
    PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • How to get Alerts mail for adapter engine errors in SAP PI 7.0

    Hi Friends,
    I configured Alerts in PI 7.0. with the help of t-code u2018ALRTCATDEF and created a new alert catergory.
    In container tab i have mentioned all give below elements.
    SXMS_MSG_GUID, SXMS_RULE_NAME, SXMS_ERROR_CAT, SXMS_ERROR_CODE, SXMS_FROM_PARTY, SXMS_FROM_SERVICE, SXMS_FROM_NAMESPACE, SXMS_FROM_INTERFACE, SXMS_TO_PARTY, SXMS_TO_SERVICE, SXMS_TO_NAMESPACE,SXMS_TO_INTERFACE
    I am getting alerts when I manually test the alerts configurations by running the report u2018RSALERTTESTu2019.
    I am getting mail as :
    Alert ID: ##00009##
    Dear Administrator,
    This is with respect to XI Scenario. During processing of XML file from ECC or XYZ Server, Following error has been occured:
    Message ID:
    Interface:
    NOTE: To check the file name, go to SXMB_MONI and search for above message ID.
    Double click on that message ID and click on error in left hand tree.
    Please take appropriate action in co-ordination with respective functional and BASIS consultant.
    But When I am getting a error , I am not getting an alert mail. Right now iam doing in XI Development.
    I am not getting an Alert mail , when my message is in status of : System Error . Error catergory is : XI_J2EE_ADAPTER_JDBC.
    Kindly tell how to get alert mail for error catergory : XI_J2EE_ADAPTER_JDBC and in Adapter engine errors.
    How to get alert mail when my message is failed with any reason in Adapter engine.
    Waiting for quick replay. Please help me out.
    Regards,
    Ahmed.

    Hi thanks for quick reply.
    As per your given link : http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/14877. [original link is broken]
    I have done all these steps. But still little problem.
    as per link he is getting Error  description , error message id , alert rule..
    In my case I am not getting these information. when my messages failed. When I am doing manully testing the alert getting an mail as :
    Alert ID: ##00009##
    Dear Administrator,
    This is with respect to XI Scenario. During processing of XML file from ECC or XYZ Server, Following error has been occured:
    Message ID:
    Interface:
    NOTE: To check the file name, go to SXMB_MONI and search for above message ID.
    Double click on that message ID and click on error in left hand tree.
    Please take appropriate action in co-ordination with respective functional and BASIS consultant.
    Is it okay the body of mail??.
    I am not getting alert mail when my messages failed in adapter engine and Integration Engine.
    Ex my message is failed in AE:as below.
    My messages flow as : SAP --> XI --> DB.
    Messages is success (in ECC moni)> XI moni also success> XI Adapter engine getting error as (Status: System Error) and (Error Category : XI_J2EE_ADAPTER_JDBC).
    Regards,
    Ahmed.

  • Count() for each group, but only groups having 1+ element like... AND all elements like...

    There are tables(and columns) like:
    'Clients'(clientID)
    'Houses' (houseID)
    'Visits' (clientID, houseID, visit_date)
    'Contracts'(contractID, houseID, clientID, rentDate_from, rentDate_end)
    I have problem with writing MS SQL query of this kind:
    how many visits to houses did each client, before renting one of them?
    Its easy to count total number of Visits for each client, listing all visits + group by clientID and selecting count(*) for each group.
    Lets say this is select_1, and select_2 is listing all Contracts for all clients.
    Select_1 is not answer, because count must be performed only on groups, which:
    -have at least 1 row "like" row in select_2 (it means that at least one of visited houses was rented, because it can happen that client visited few houses, but rented other, not visited house). my idea for this is comparing select_1 and select_2 with:
    "where s1.clientID=s2.clientID and s1.houseID=s2.houseID"
    -each group must have all rows(visits) with date of same day or earlier than contract date
     maybe: "datediff(day, s1.visit_date, s2.rentDate_from) >= 0"

    In future, please provide proper DML, DDL and example data, like I have for you below.
    DECLARE @clients TABLE (clientID INT, name VARCHAR(20))
    INSERT INTO @clients (clientID, name)
    VALUES (1, 'Jonathan'),(2, 'Christopher'),(3, 'James'),(4, 'Jean-Luc'),(5, 'William')
    DECLARE @houses TABLE (houseID INT, address VARCHAR(20))
    INSERT INTO @houses (houseID, address)
    VALUES (1, 'NX01'),(2, 'NCC 1701'),(3, 'NCC 1071A'),(4, 'NCC 1701D'),(5, 'NCC 1701E')
    DECLARE @visits TABLE (clientID INT, houseID INT, visitDateTime DATETIME)
    INSERT INTO @visits (clientID, houseID, visitDateTime)
    VALUES (1,1,'2001-01-01 12:13:14'),
    (2,2,'2001-01-02 12:13:14'),
    (3,2,'2001-01-01 12:13:14'),(3,3,'2001-01-01 12:13:14'),
    (4,4,'2001-01-01 12:13:14'),(4,5,'2001-01-01 12:13:14'),
    (5,4,'2001-01-01 12:13:14'),(5,5,'2001-01-01 12:13:14')
    DECLARE @contracts TABLE (contractID INT IDENTITY, houseID INT, clientID INT, rentStartDate date, rentEndDate date)
    INSERT INTO @contracts (houseID, clientID, rentStartDate, rentEndDate)
    VALUES (1,1,'2001-01-02',NULL),(2,2,'2001-01-02',NULL),(3,3,'2001-01-02',NULL),(4,4,'2001-01-02',NULL),(5,5,'2001-01-02',NULL)
    SELECT contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address, COUNT(v.clientID) AS visits
    FROM @contracts c
    LEFT OUTER JOIN @clients cl
    ON c.clientID = cl.clientID
    LEFT OUTER JOIN @houses h
    ON c.houseID = h.houseID
    LEFT OUTER JOIN @visits v
    ON c.clientID = v.clientID
    AND c.rentStartDate >= v.visitDateTime
    GROUP BY contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address

  • 206 unable to set alert only for certain group

    Hi,
    is it a symbian unwanted feature that user is unable to set Nokia 206
    profile to alert for certain group (even though this kind of functionality is
    available on this phone)?
    To be more precise user is able to set profile to alert only for certain
    group but this setting has no effect (phone rebooted, groups recreated, etc. no effect)
    This feature has been available and workin in previous Nokia phones
    since last decace - is it a software quality issue or what.
    Best regards,
    Hez

    It is the Application Pool account making the query to retrieve the groups, so you would need to establish a trust from Domain B -> A.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • I do not get alert sound for in coming SMS on locked screen after iOS update to latest version

    I do not get alert sound for in coming SMS on locked screen after iOS update to latest version

    Settings > Do Not Disturb > OFF

  • CR - giving total transaction count for few groups and 0 for few groups.

    For the column "No of First Call Resolution" I have to count no of interactions based on the Interaction Result, the formula is
    COUNT(Interaction_ID) WHERE INTERACTION_RESULT = 'FCR'
    For which, I wrote the below formula
    If {14CICustomerInteractions_query.Interaction Result} = "FCR" then Count ({14CICustomerInteractions_query.Interaction_ID})
    I have 33,232 interactions on the particular day I selected. When I try to group up and do the calculations it is giving total transaction count for few groups and 0 for few groups.
    Need Solution

    Hi,
    What field is the report grouped on?
    If you wish to find the no of interactions based on some condition and display it for every group, then here's what you need to do:
    1) Create this formula and place this on the details section:
    whileprintingrecords;
    numbervar c;
    If {14CICustomerInteractions_query.Interaction Result} = "FCR" then
    c := c + 1;
    2) Create another formula and place this one on the Group Footer:
    whileprintingrecords;
    numbervar c;
    3) Create this formula to reset the variable and place this on the Group Header:
    whileprintingrecords;
    numbervar c := 0;
    Let me know how this goes!
    -Abhilash

  • SQL Report - Software count for specific hostnames

    Hi all,
    I'm currently using the below query to get the count of all software in Add/Remove Programs for a specific collection:
    Declare @CollID char(8)
    Set @CollID = 'XXX00001'
    SELECT DisplayName0, Count(*) AS 'Count', Publisher0, Version0, @CollID as CollectionID
    FROM v_Add_Remove_Programs arp
    JOIN v_FullCollectionMembership fcm on arp.ResourceID=fcm.ResourceID
    WHERE fcm.CollectionID = @CollID and
    GROUP BY DisplayName0, Publisher0, Version0
    ORDER BY Publisher0, Version0
    Now, what I would like to do is to specify the All Systems collection ID (not a problem) but add a couple of extra condition:
    I want to run the query only WHERE the hostnames start with SITE1 or SITE2.
    How can I modify the above to achieve the results I'm expecting? I'm getting stuck here and there :(
    Thanks a lot

    Thanks Torsten, you put me on the right direction.
    If somebody's interested, this is the query I'm running now:
    Declare @CollID char(8)
    Set @CollID = 'XXX00001'
    SELECT DisplayName0, Count(*) AS 'Count', Publisher0, Version0, @CollID as CollectionID
    FROM v_Add_Remove_Programs arp
    JOIN v_FullCollectionMembership fcm on arp.ResourceID=fcm.ResourceID
    JOIN v_R_System_Valid rsv on arp.ResourceID=rsv.ResourceID
    WHERE fcm.CollectionID = @CollID and rsv.Netbios_Name0 LIKE '%SITECODE1%' GROUP BY DisplayName0, Publisher0, Version0
    ORDER BY Publisher0, Version0

  • Pixel counts for specific RGB values

    Can Photoshop CS4 find pixel counts in an
    image for specific RGB values?  Where would
    you input these RGB values and would you see the pixels highlighted and totaled?

    Hi Zeno:
    Thank you very much for your response!
    Your directions work very well for a single image.  I have an entire series of images and was wondering if I could just enter a specific set RGB values some where and see a total pixel count for each one of them.
    When I go to foreground color and enter the RGB values there and then set the color range to zero and press OK, I get a Warning: No pixels were selected message.
    Any additional advice that you have would be much appreciated.
    Thanks, Bretzfrog

  • TSQL Get Previous values for each group by

    Dear Friends,
    I have a problem with my TSQL statment. 
    I need to get previous value for each day and specific unit. Everything goes fine if I have always 2 unit in each day. But if same day has just one unit or less, I cannot have the previous value in the current record.
    The Output is this one:
    SK_DAY SK_UNIT
    VALUE VALUE_PREVIUS_DAY
    20131112 2
    30.00 NULL
    20131112 3
    34.00 NULL
    20131113 2
    40.00 30.00
    20131113 3
    45.00 34.00
    20131114 2
    50.00 40.00
    I dont have the second record for 2013-11-14, because in this date I just have value for unit 2.
    The final output should include the record:
    20131114 3
    0 45.00
    The Statment I have is:
    SELECT MAIN.SK_DAY, MAIN.SK_UNIT, SUM(MAIN.VALUE) AS VALUE
     SELECT SUM(VND1.VALUE) AS VALUE
     FROM FCT_TEST VND1
     WHERE CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))>=DATEADD(dd,-1,CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY)))
    AND CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))<CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY))
    AND VND1.SK_UNIT=MAIN.SK_UNIT
    ) AS VALUE_PREVIUS_DAY
    FROM FCT_TEST MAIN
    GROUP BY SK_DAY, MAIN.SK_UNIT
    SQL CREATE SCRIPT:
    CREATE TABLE [dbo].[FCT_TEST](
    [SK_DAY] [int] NOT NULL,
    [SK_UNIT] [int] NOT NULL,
    [VALUE] [decimal](18, 2) NULL,
     CONSTRAINT [PK_FCT_TEST] PRIMARY KEY CLUSTERED 
    [SK_DAY] ASC,
    [SK_UNIT] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Thank you!!!
    PPSQL

    Thank you Kalman,
    But my problem is not with date! Fortunately I have dates for all days.
    The problem is for dimension tables like UNITS that I dont have values for all days, and when I try to get the previous value for previous day and each unit I dont have records. 
    20131112
    2
     30.00
    NULL
    20131112
    3
     34.00
    NULL
    20131113
    2
     40.00
    30.00
    20131113
    3
     45.00
    34.00
    20131114
    2
     50.00
    40.00
    20131114
    3
     0
    45.00 [I NEED THIS RECORD AS IS]
    Could you help me??
    Thank you!!

  • Automounts for specific groups

    Hi,
    I set up automounts via AFP on a 10.3.9 server, they work fine on Panther and Tiger clients. Now I want to assign the automounts to specific groups of users (or computers, as my users don't switch machines). Right now the automounts appear on every client on the subnet but I want Group A to get share A and NOT share B which is only for Group B and so on.
    At the moment all users have local home directories, no OD etc in use. DNS and OD master are set up and run fine.
    Is there a way to accomplish this task?
    I am thankful for every hint.
    MK

    Here is one example:
    <http://www.uni-muenster.de/IVVNWZ/Vortraege/DECUS2005/3D02%20-%20Benutzerverwal tung%20in%20heterogenen%20Betriebssystemumgebungen%20mit%20Active%20Directory.pd f#search=%22login%20mount%20linux%20ldap%20mac%22>
      Other OS  

  • How to get pages list for a group space or create a page for a group space

    hi All,
    I am using wc11.1.1.3, I want to use java api to implementing the following functions in site template:
    1. Get pages list for a given group space
    2. Create a page for a given group space
    I researched the following codes from web site:
    PageDef newPage = mPageService.createPage(
    PERSONAL_USER_PAGE, pageNameFormat, pageTitle,
    "MyPageTemplate1.jspx",
    "/mytemplates/",
    null, null, null);
    What should be used instead of PERSONAL_USER_PAGE if a group space page is intended to be created? which parameter is for defining group space name that the page should be created for?
    By the way, PageService seems has method for getting list of pages, but how to use it to get page list which is in a specified gs?
    Best regards

    did you manage to get the page list using Page Service API?

  • How to get attendies count for a calendar list in sharepoint 2013?

    Hi everybody,
    I am using calendar list in SharePoint 2013 for my project.
    Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
    Because I want to display the fields like
    TOTAL SEATS =20
    Attendees= Need count
    Avail seats= total - Attendees count.
    In that way I want to show information about availability seats for training session.
    Regards,
    Dhayanand

    Hi Dhaya
    Please refer the links.Hope it helps :-)
    http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
    http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow

  • Trying to get row counts for all tables at a time

    Hi,
    i am trying to get row counts in database at a time with below query but i am getting error:
    its giving me ora-19202 error..please advise me
    select
          table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name))
              ,'/ROWSET/ROW/C')
              count
        from all_tables;

    ALL_TABLES returns tables/views current user has access to. These tables/views are owned not just by current user. However your code
    dbms_xmlgen.getxml('select count(*) c from '||table_name)does not specify who the owner is. You need to change it to:
    dbms_xmlgen.getxml('select count(*) c from '||owner || '.' || table_name)However, it still will not work. Why? As I said, ALL_TABLES returns tables/views current user has access to. Any type of access, not just SELECT. So if current user is, for example, granted nothing but UPDATE on some table the above select will fail. You would have to filter ALL_TABLES through ALL_SYS_PRIVS, ALL_ROLE_PRIVS, ALL_TAB_PRIVS and PUBLIC to get list of tables current user can select from. For example, code below does it for tables/views owned by current user and tables/views current user is explicitly granted SELECT:
    select
          t.owner,
          t.table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.owner || '.' || t.table_name))
              ,'/ROWSET/ROW/C')
              count
        from all_tables t,user_tab_privs p
        where t.owner = p.owner
          and t.table_name = p.table_name
          and privilege = 'SELECT'
    union all
    select
          user,
          t.table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.table_name))
              ,'/ROWSET/ROW/C')
              count
        from user_tables t
    OWNER                          TABLE_NAME                                                          COUNT
    SCOTT                          DEPT                                                                    4
    U1                             QAQA                                                                    0
    U1                             TBL                                                                     0
    U1                             EMP                                                                     1
    SQL> SY.

Maybe you are looking for