{"id":860,"date":"2009-07-30T08:00:20","date_gmt":"2009-07-30T06:00:20","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=860"},"modified":"2010-09-01T12:19:34","modified_gmt":"2010-09-01T10:19:34","slug":"configure-command-notification-in-r2","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=860","title":{"rendered":"Configure Command Notification in R2"},"content":{"rendered":"<p>There has been a number of questions about the command notification channel in Technet forums. Here is a example how to configure a command notification channel, a subscriber for the channel and a subscription. This example configure a command notification channel to run a vbscript. The vbscript echo a time stamp and the alertname to a local file.<\/p>\n<p>1. Go to Administration\/Notification\/Channels and create a new command notification channel. For example<br \/>\nChannel name: Contoso Command Notification Channel<br \/>\nFull path of the command file: C:\\windows\\system32\\cmd.exe<br \/>\nCommand line paramters: \/c C:\\logfile.vbs $Data\/Context\/DataItem\/AlertName$<br \/>\nStartup folder for the command line: C:\\<\/p>\n<p>2. Go to Subscribers and create a new subscriber<br \/>\nSubscriber name: Contoso Command Line Subscriber (note that you do not need to select a AD user)<br \/>\nSchedule: Always send notification<br \/>\nAddresses: Added a new address<br \/>\n-Address name: Contoso Command Address<br \/>\n-Channel type: Command<br \/>\n-Command Channel: Contoso Command Notification Channel<br \/>\n-Delivery address for the selected channel: I just left this with default, something about sip: but it resultet in a blank field, so just leave it<br \/>\n-Schedule: Always send notification<\/p>\n<p>3. Goto Subscriptions and add a new subscription, for example<br \/>\nName: Contoso Command Line Subscription<br \/>\nCriteria: with a specific resolution state: new(0) and closed (255)<br \/>\nSubscribers: Contoso Command Line Subscriber<br \/>\nChannel: Contoso Command Notification Channel<br \/>\nSummary: Make sure the channel is enabled<\/p>\n<p>Thats it, and the logfile.vbs looks like:<br \/>\n<code><br \/>\n' ******************************************<br \/>\n' GET PARAMETERS INTO SCRIPT<br \/>\n' ******************************************<br \/>\nstrAlert = Wscript.Arguments.Item(0)<\/code><\/p>\n<p>&#8216; ******************************************<br \/>\n&#8216; LOG TO FILE (DATE,TIME,TO,ALERT NAME,STATE<br \/>\n&#8216; ******************************************<br \/>\nDim Stuff, myFSO, WriteStuff, dateStamp<br \/>\nstrdateStamp = Date()<br \/>\nstrTimeStamp = Time()<br \/>\n&#8216;Write information to Text File<br \/>\nStuff = strDateStamp &amp; &#8220;,&#8221; &amp; strTimeStamp &amp; &#8220;,&#8221; &amp; strAlert<br \/>\nSet myFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br \/>\nSet WriteStuff = myFSO.OpenTextFile(&#8220;opsmgr_notification_logfile.txt&#8221;, 8, True)<br \/>\nWriteStuff.WriteLine(Stuff)<br \/>\nWriteStuff.Close<\/p>\n<p>More info about command notification channel <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dd440871.aspx\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There has been a number of questions about the command notification channel in Technet forums. Here is a example how to configure a command notification channel, a subscriber for the channel and a subscription. This example configure a command notification channel to run a vbscript. The vbscript echo a time stamp and the alertname to &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=860\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[13,19],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/860"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=860"}],"version-history":[{"count":13,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":901,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/860\/revisions\/901"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}