# Powershell notification command

**URL:** <https://community.squaredup.com/t/powershell-notification-command/1413>\
**Category:** PowerShell\
**Tags:** notifications, scom-1801, powershell\
**Created:** [May 4, 2021, 5:12am UTC](https://community.squaredup.com/t/powershell-notification-command/1413 "2021-05-04T05:12:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucvb](https://community.squaredup.com/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lucvb](https://community.squaredup.com/u/lucvb)\
**Post date:** [May 4, 2021, 5:12am UTC](https://community.squaredup.com/t/powershell-notification-command/1413/1 "2021-05-04T05:12:23Z")

</div>

Hi,  
I have created a group in scom with all the components of an application. When there is an alert on one of these components a notification is running with a command channel to call a powershell scripts. This script is accepting the alert-id, load the operationsmanager module and is changing the resolutionstate of the alert.  
All this is working fine, but when we are getting many alerts on the same time for this group, there is a large delay in changing the resolution states.  
How can we fix this?  
Kind regards, Luc

---

<div class="post-metadata">

**Author:** ![steve89](https://community.squaredup.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@steve89](https://community.squaredup.com/u/steve89)\
**Post date:** [May 4, 2021, 1:33pm UTC](https://community.squaredup.com/t/powershell-notification-command/1413/2 "2021-05-04T13:33:12Z")

</div>

Hi Luc,

Check your open alerts for a warning on your management servers called “Operations Manager failed to start a process due to lack of resources.”

By default, the management servers can only run a few scripts at a time. There is a registry value that can be changed to increase the number.

The registry key is: HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Modules\Global\Command Executer

The registry value is:  
Name: AsyncProcessLimit  
Type: DWORD (32-bit)  
Base: Decimal

I set the value to 20 at first but later had to increase it to 40.

I have a command channel that calls a PowerShell script to put a server in maintenance mode for 10 minutes when a clean reboot is detected. The value had to be increased from 20 to 40 because the script wasn’t always running during maintenance windows when a lot of servers were rebooting.

-Steve

---

<div class="post-metadata">

**Author:** ![pchip](https://community.squaredup.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@pchip](https://community.squaredup.com/u/pchip)\
**Post date:** [May 5, 2021, 8:25pm UTC](https://community.squaredup.com/t/powershell-notification-command/1413/3 "2021-05-05T20:25:56Z")

</div>

Nice one Steve. I too have ran into this issue as well but happened so rarely I never bothered to look further into it.

@lucvb (and Steve) if you’re up to it, may want to give a look at this post from Kevin Holman [Monitor an agent – but run response on a Management Server - Kevin Holman's Blog](https://kevinholman.com/2018/11/08/monitor-an-agent-but-run-response-on-a-management-server/)  
Like this you would skip entirely the command channel…

---

<div class="post-metadata">

**Author:** ![lucvb](https://community.squaredup.com/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lucvb](https://community.squaredup.com/u/lucvb)\
**Post date:** [May 7, 2021, 6:18am UTC](https://community.squaredup.com/t/powershell-notification-command/1413/4 "2021-05-07T06:18:14Z")

</div>

Hi Steve, thanks for your answer.  
I don’t have this registry key on my management server.  
I have nothing under HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Modules\Global.  
Do I have to create this key?

---

<div class="post-metadata">

**Author:** ![steve89](https://community.squaredup.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@steve89](https://community.squaredup.com/u/steve89)\
**Post date:** [May 7, 2021, 3:29pm UTC](https://community.squaredup.com/t/powershell-notification-command/1413/5 "2021-05-07T15:29:08Z")

</div>

Hi Luc,

I don’t remember if it was there when I set up everything. In my notes, I wrote “If the Command Executer key doesn’t exist, create it.” I would guess that it’s probably not there by default on most or all installations. I also have a note to restart HealthService after adding everything.

-Steve

---

<div class="post-metadata">

**Author:** ![shawn149](https://community.squaredup.com/user_avatar/community.squaredup.com/shawn149/32/822_2.png) [@shawn149](https://community.squaredup.com/u/shawn149)\
**Post date:** [May 7, 2021, 5:15pm UTC](https://community.squaredup.com/t/powershell-notification-command/1413/6 "2021-05-07T17:15:54Z")

</div>

If you do use the AsyncProcessLimit registry change, be sure to make this change on **ALL** of your management servers.

To make things easier, here is some PowerShell to do the heavy lifting:

```
# AsyncProcessLimit
$Value = "20"
$Key = "AsyncProcessLimit"
$Path = "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Modules\Global\Command Executer"
$Type = "DWord"

# Create the path if it doesn't exist
IF (!(Test-Path $Path)) {
    New-Item -Path $Path -Force
}

# Create and set the key, if it doesn't exist
Set-ItemProperty -Name $Key -Path $Path -Value $Value -Type $Type
```

---

<div class="post-metadata">

**Author:** ![lucvb](https://community.squaredup.com/letter_avatar_proxy/v4/letter/l/94ad74/32.png) [@lucvb](https://community.squaredup.com/u/lucvb)\
**Post date:** [May 11, 2021, 10:59am UTC](https://community.squaredup.com/t/powershell-notification-command/1413/7 "2021-05-11T10:59:36Z")

</div>

Hi everyone, thanks for all of your anwsers. I’ve added the registry key and it seems to be working fine. Thanks, Luc
