{"id":222,"date":"2007-09-18T08:31:39","date_gmt":"2007-09-18T06:31:39","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=222"},"modified":"2010-09-01T12:32:45","modified_gmt":"2010-09-01T10:32:45","slug":"update-custom-fields-in-ops-mgr-2007","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=222","title":{"rendered":"Update Custom Fields in Ops Mgr 2007"},"content":{"rendered":"<p>I have built a script to update alert customfields\u00c2\u00a0in Ops Mgr 2007. I have done this for MOM 2005 too, more info <a href=\"http:\/\/contoso.se\/blog\/?p=99\">here<\/a>. In MOM 2005 I did it with a couple of rules. In Ops Mgr 2007 I solve it with a schedule task. My first idea was to run it as a command notification, but I ran into a permission issues. You can setup\u00c2\u00a0this script\u00c2\u00a0as a schedule task, and run it every X minute.\u00c2\u00a0It will load Ops Mgr command shell snap-in and then get all new alerts (ResolutionState = 0). The script w\u00c3\u00adll then get the computername from the alert and run some Active Directory queries based on that computername. The result from these queries will be input in the alert custom fields. Some alerts does not have a netbioscomputername attribute, therefor these alerts will not be updated, for example some Active Directory alerts.<\/p>\n<p>You can customize the script any way you want. With this example I want to show you one way to do it, with some example attributes. Download the script <a href=\"http:\/\/www.contoso.se\/files\/update_custom_fields.ps1\">here<\/a>.<\/p>\n<div style=\"text-align: center;\"><img decoding=\"async\" title=\"Custom Fields in Ops Mgr\" src=\"http:\/\/www.contoso.se\/files\/Custom_Fields_Update.jpg\" alt=\"Custom Fields in Ops Mgr\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have built a script to update alert customfields\u00c2\u00a0in Ops Mgr 2007. I have done this for MOM 2005 too, more info here. In MOM 2005 I did it with a couple of rules. In Ops Mgr 2007 I solve it with a schedule task. My first idea was to run it as a command &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=222\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","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\/222"}],"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=222"}],"version-history":[{"count":1,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":1783,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions\/1783"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}