{"id":2635,"date":"2011-09-29T23:31:58","date_gmt":"2011-09-29T21:31:58","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=2635"},"modified":"2011-10-02T21:31:50","modified_gmt":"2011-10-02T19:31:50","slug":"maintenance-mode-report-part-ii","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=2635","title":{"rendered":"Maintenance Mode Report (part II)"},"content":{"rendered":"<p>In the\u00c2\u00a0<a title=\"Notification and reporting for maintenance mode\" href=\"http:\/\/contoso.se\/blog\/?p=1016\">Notification and reporting for maintenance mode<\/a> post we created a report for every object that is in maintenance mode. I did a update to that script today, instead of showing all objects that are in maintenance mode the report now only show computer objects. You can download the script <a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/09\/MMReport.txt.txt\">MMReport.txt<\/a> (rename to .ps1). As you can see on the last two lines in the script, the script is stopping it self.\u00c2\u00a0These lines are\u00c2\u00a0needed it you want to run the script from Orchestrator and the &#8220;Run Program&#8221; activity, else the activity will not finish and move on in the runbook.<\/p>\n<blockquote><p>$objCurrentPSProcess = [System.Diagnostics.Process]::GetCurrentProcess();<br \/>\nStop-Process -Id $objCurrentPSProcess.ID;<\/p><\/blockquote>\n<p>If you want to run this in Orchestrator, for example\u00c2\u00a0every 15 minutes to generate a update maintenance mode report, you can use a &#8220;Monitor Date\/Time&#8221; activity and then a &#8220;Run Program&#8221; activity. You can configure the &#8220;Run Program&#8221; activity with the following settings<\/p>\n<ul>\n<li>\u00c2\u00a0Program execution<\/li>\n<li>Computer: FIELD-SCO01 (name of a suitable server with Operations Manager shell installed)<\/li>\n<li>Program path: powershell.exe<\/li>\n<li>Parameters: -command C:\\scripts\\MMreport.ps1<\/li>\n<li>Working folder: (no value)<\/li>\n<\/ul>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/09\/20110929_MMReport01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2640\" title=\"20110929_MMReport01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/09\/20110929_MMReport01-300x88.jpg\" alt=\"\" width=\"300\" height=\"88\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/09\/20110929_MMReport01-300x88.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/09\/20110929_MMReport01.jpg 925w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Remember that your Orchestrator runbook server service account needs permissions in Operations Manager to get the info. With this sample script the output file will be C:\\temp\\MMreport.htm. Thanks to <a href=\"http:\/\/blogs.technet.com\/b\/stefan_stranger\/\">Stefan Stranger<\/a> for PowerShell ideas.<\/p>\n<p>Please note that this is provided \u00e2\u20ac\u0153as is\u00e2\u20ac\u009d with no warranties at all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the\u00c2\u00a0Notification and reporting for maintenance mode post we created a report for every object that is in maintenance mode. I did a update to that script today, instead of showing all objects that are in maintenance mode the report now only show computer objects. You can download the script MMReport.txt (rename to .ps1). As &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=2635\">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":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2635"}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2635"}],"version-history":[{"count":8,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2635\/revisions"}],"predecessor-version":[{"id":2645,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2635\/revisions\/2645"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2635"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}