Implementing previous post by using Visual Studio Authoring Extension

Implementation the previous post "SCOM Rule contains timed script and Alert without condition" are already been covered by Jonathan Almquist -  https://blogs.technet.microsoft.com/jonathanalmquist/2010/05/25/how-to-generate-an-alert-directly-from-a-script-based-rule/

but Jonathan explains how to write this rule by MP Authoring tool, I will show you how to create this rule by using Visual Studio Authoring Extension:

first you need to download the VSAE : https://www.microsoft.com/en-us/download/details.aspx?id=30169

# Create New Project

# Select SCOM Version

# Create New Folder

# Rule (Custom)

# Select the Rule, in right side look on the following options: Data Source / Condition Detection / Write Action

 

# Data Source ... Select "TimedScript.PropertyBag"

# In Data Source Configuration, write the Script, and click OK

# First Select Target Class, In Condition Detection Type ID, Select System.ExpressionFilter

 

# Condition Detection Configuration, Config the Property Bag Output

# Write Action ... Select GenerateAlert TypeID

# Data Source Configuration ...

# Build Solution

# Management Pack file location

# in Solution folder - bin\debug, copy XML file, and Import it to SCOM