# Powershell MP for scom

**URL:** <https://community.squaredup.com/t/powershell-mp-for-scom/1936>\
**Category:** PowerShell\
**Tags:** scom, powershell\
**Created:** [November 23, 2022, 7:28pm UTC](https://community.squaredup.com/t/powershell-mp-for-scom/1936 "2022-11-23T19:28:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yvi](https://community.squaredup.com/letter_avatar_proxy/v4/letter/y/76d3ee/32.png) [@yvi](https://community.squaredup.com/u/yvi)\
**Post date:** [November 23, 2022, 7:28pm UTC](https://community.squaredup.com/t/powershell-mp-for-scom/1936/1 "2022-11-23T19:28:02Z")

</div>

Hi Guys, need your help. I created group in SCOM and want to assign powershell script monitor to that group. The script itself works when i assign in to class Windows Computers, but doesnt working for a group. Im quite new in SCOM, might do something wrong. Any help would be very useful. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![an\_evil\_penguin](https://community.squaredup.com/user_avatar/community.squaredup.com/an_evil_penguin/32/858_2.png) [@an\_evil\_penguin](https://community.squaredup.com/u/an_evil_penguin)\
**Post date:** [November 25, 2022, 8:12am UTC](https://community.squaredup.com/t/powershell-mp-for-scom/1936/2 "2022-11-25T08:12:11Z")

</div>

Hi Yvi, and welcome to the community!

Groups don’t really work as most people expect them to in SCOM, and (with some exceptions) you don’t normally ask them to do the monitoring. Mostly they are used for health rollups and organization purposes.  
The group is run by the management group and all processes related to the group are run by the management server that happens to be looking after the group at the time. So the script will run on the management server and _not_ on the agents of the computers in the group.

In this scenario, a better approach is to make a new class for those computers and target the monitor to that class instead. That way the monitor will be targeted at the agents looking after the computers and the script will run where you expect.

Kevin Holman has a number of examples of creating custom classes in a variety of scenarios, here’s two that I found quickly along these sorts of lines:

> **[How to discover instances of a SCOM class based on Computer Name - Kevin...](https://kevinholman.com/2019/07/25/how-to-discover-instances-of-a-scom-class-based-on-computer-name/)**
>
> When creating rules and monitors in SCOM, we need a good, specific class for targeting. Often times, a customer will come to you and say…

> **[Writing a custom class for your network devices - Kevin Holman's Blog](https://kevinholman.com/2016/04/20/writing-a-custom-class-for-your-network-devices/)**
>
>   While there is built in monitoring for network devices in SCOM – there are scenarios where we want to create custom classes for specific…

If you’re new to SCOM and getting into custom monitoring I would highly recommend following through the Management Pack Authoring course on Microsoft Learn:

> **[System Center 2012 R2 Operations Manager Management Packs](https://learn.microsoft.com/en-gb/shows/system-center-2012-r2-operations-manager-management-packs/)**
>
> If you already have some familiarity with the basic functionality of Management Packs and would like to expand your Service Pack knowledge, this is the course for you! It drills down into the structure, implementation, and development of Management...

Don’t let the SCOM version put you off, very little has changed around the core monitoring piece since 2012 R2. To this day I think this is one of the most valuable SCOM resources I have found!

Hope this helps!  
EP

---

<div class="post-metadata">

**Author:** ![yvi](https://community.squaredup.com/letter_avatar_proxy/v4/letter/y/76d3ee/32.png) [@yvi](https://community.squaredup.com/u/yvi)\
**Post date:** [November 25, 2022, 10:32am UTC](https://community.squaredup.com/t/powershell-mp-for-scom/1936/3 "2022-11-25T10:32:40Z")

</div>

Thank you very much An\_Evil\_Penguin for hint, that is really helpful.
