Customizing Community Power-shell Management Pack

Hi All,

Recently imported Community Powershell script MP. Looking to achieve following things.


  1. Sending output to email
  2. Sending email if a output contains so and so numeric or alphabetic value
Can someone please help me with above monitoring needs?




Hi Rajesh,


this Management Pack allows you to place any kind of PowerShell code insight a monitor or a rule.

In PowerShell you can leverage the ‘Send-Mailmessage’ cmdlet to send e-Mails.

Here a short example:


$result = 5 + 5

if ($result -gt 8) {
	$mailBody = "Result greater than 8. In detail: $($result) "
	$mailMessageParms = @{
		To          = '[email protected]'
		From        = '[email protected]'
		Subject     = "This is the subect"
		Body        = $mailBody
		Smtpserver  = 'mailserver.contsole.msft'
		ErrorAction = "SilentlyContinue"		

} else {
	$foo = 'Not sending E-Mail.'


SCOM offers out of the box a very flexible way for notifications. Here is a nice walk-through:


One caveat here is that in more secure environments individual servers might not be allowed to send email. So putting the email in the rule or monitor might not work.

Is there any reason you want to avoid using SCOM subscriptions (email notifications)?

1 Like