Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

Management Pack - VBScript Property Bag Timer and Alert [Without Condition]

$
0
0

<?xml version="1.0" encoding="UTF-8"?>

-<ManagementPack xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" OriginalSchemaVersion="2.0" SchemaVersion="2.0" ContentReadable="true">


-<Manifest>


-<Identity>

<ID>ScriptandAlert</ID>

<Version>1.0.0.10</Version>

</Identity>

<Name>ScriptandAlert</Name>


-<References>


-<Reference Alias="Windows">

<ID>Microsoft.Windows.Library</ID>

<Version>7.5.8501.0</Version>

<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

</Reference>


-<Reference Alias="System">

<ID>System.Library</ID>

<Version>7.5.8501.0</Version>

<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

</Reference>


-<Reference Alias="Health">

<ID>System.Health.Library</ID>

<Version>7.0.8433.0</Version>

<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

</Reference>

</References>

</Manifest>


-<Monitoring>


-<Rules>


-<Rule DiscardLevel="100" Priority="Normal" Remotable="true" ConfirmDelivery="false" Target="Windows!Microsoft.Windows.OperatingSystem" Enabled="false" ID="ScriptandAlert.NewRule">

<Category>None</Category>


-<DataSources>


-<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">

<IntervalSeconds>120</IntervalSeconds>

<SyncTime/>

<ScriptName>log.vbs</ScriptName>

<Arguments/>

<ScriptBody> Option Explicit Dim oAPI,oBag,sMyScriptValue, shell Set oAPI=CreateObject("MOM.ScriptAPI") Set oBag=oAPI.CreatePropertyBag() sMyScriptValue="AlertCondition" Set shell=CreateObject("WScript.Shell") shell.LogEvent 4,"start the script" Call oBag.AddValue("MyScriptPropertyName",sMyScriptValue) Call oAPI.Return(oBag) </ScriptBody>

<TimeoutSeconds>60</TimeoutSeconds>

</DataSource>

</DataSources>


-<ConditionDetection ID="CD" TypeID="System!System.ExpressionFilter">


-<Expression>


-<SimpleExpression>


-<ValueExpression>

<XPathQuery Type="String">Property[@Name='MyScriptPropertyName']</XPathQuery>

</ValueExpression>

<Operator>Equal</Operator>


-<ValueExpression>

<Value Type="String">AlertCondition</Value>

</ValueExpression>

</SimpleExpression>

</Expression>

</ConditionDetection>


-<WriteActions>


-<WriteAction Target="Windows!Microsoft.Windows.Computer" ID="WA" TypeID="Health!System.Health.GenerateAlert">

<Priority>2</Priority>

<Severity>2</Severity>

<AlertMessageId>$MPElement[Name="AlertMessageID81358ed3f16a45f58dfba92b78c5658b"]$</AlertMessageId>


-<AlertParameters>

<AlertParameter1>$Data/Property[@Name='MyScriptPropertyName']$</AlertParameter1>

</AlertParameters>

</WriteAction>

</WriteActions>

</Rule>

</Rules>

</Monitoring>


-<Presentation>


-<StringResources>

<StringResource ID="AlertMessageID81358ed3f16a45f58dfba92b78c5658b"/>

</StringResources>

</Presentation>


-<LanguagePacks>


-<LanguagePack ID="ENU" IsDefault="true">


-<DisplayStrings>


-<DisplayString ElementID="ScriptandAlert.NewRule">

<Name>New Rule</Name>

<Description>Description for the new rule</Description>

</DisplayString>


-<DisplayString ElementID="ScriptandAlert.NewRule" SubElementID="WA">

<Name>WA</Name>

</DisplayString>


-<DisplayString ElementID="ScriptandAlert.NewRule" SubElementID="DS">

<Name>Script Property Bag Data Provider</Name>

</DisplayString>


-<DisplayString ElementID="ScriptandAlert.NewRule" SubElementID="CD">

<Name>CD</Name>

</DisplayString>


-<DisplayString ElementID="AlertMessageID81358ed3f16a45f58dfba92b78c5658b">

<Name>Log Test</Name>

<Description>{0}</Description>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>


Viewing all articles
Browse latest Browse all 34890

Trending Articles