{"id":77553,"date":"2016-03-14T00:01:42","date_gmt":"2016-03-14T07:01:42","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=77553"},"modified":"2019-02-18T09:10:53","modified_gmt":"2019-02-18T16:10:53","slug":"control-management-pack-updates-between-ms-oms-and-operations-manager","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/control-management-pack-updates-between-ms-oms-and-operations-manager\/","title":{"rendered":"Control management pack updates between MS OMS and Operations Manager"},"content":{"rendered":"<p><strong>Summary<\/strong>: Learn how to disable automatic management pack updates from MS OMS\u00a0to Operations Manager and limit updates to a specific time window.<\/p>\n<p>Hi all, Brian Wren here. I usually spend my time writing documentation for TechNet and Azure.com, but I\u2019ve been hearing about an issue from a few customers that I wanted to address. We\u2019re going to get some detailed documentation out on this, but a quick blog entry should suffice in the meantime.<\/p>\n<p>When you connect a management group in System Center Operations Manager (SCOM) to Log Analytics in Operations Management Suite (OMS), several management packs are automatically installed in your management group. In addition to a core set of management packs to support the connection and basic data collection, others will be installed for different solutions that you\u2019ve added to your OMS\u00a0workspace. You can have a look at the entire list by doing a search for <em>Advisor<\/em> under <strong>Management Packs<\/strong> in the <strong>Administration<\/strong> workspace.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-01.png\"><img decoding=\"async\" width=\"300\" height=\"145\" class=\"alignnone size-medium wp-image-77563\" alt=\"Screenshot of results for search for Advisor in Operations Management Suite workspace.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-01-300x145.png\" \/><\/a><\/p>\n<p>After initial installation, SCOM will regularly check OMS\u00a0for updates to these management packs and automatically download and import them when they\u2019re available. This works well in many environments because your integration between SCOM and OMS\u00a0is automatically kept up to date with no effort on your part. This can be a problem though in environments that have low bandwidth or stringent change control processes. In these cases, you may want to turn off this automatic updating so that bandwidth is not consumed at peak hours and changes are not made outside your approved time window.<\/p>\n<p>This update process is controlled by the following two rules.<\/p>\n<ul>\n<li><strong>Microsoft.SystemCenter.Advisor.MPUpdate<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 60px\">Updates the base OMS\u00a0management packs. Runs every 12 hours by default.<\/p>\n<ul>\n<li><strong>Microsoft.SystemCenter.Advisor.Core.GetIntelligencePacksRule<\/strong><\/li>\n<\/ul>\n<p style=\"padding-left: 60px\">Updates management packs for solutions in your workspace. Runs every 5 minutes by default.<\/p>\n<p>You can easily disable automatic updates by <a target=\"_blank\" href=\"https:\/\/technet.microsoft.com\/library\/hh230704(v=sc.12).aspx\">creating an override<\/a> to disable those two rules. You can reverse the override to enable them again and allow the updates to run, and you should enable them periodically to keep your management group up to date.<\/p>\n<h3>Override the update rules<\/h3>\n<p>You\u2019re probably already familiar with creating an override in SCOM, but if not, I\u2019ll go ahead and walk through it here.<\/p>\n<p>Both of those rules are targeted at a class named <strong>Operations Manager Management Group<\/strong> (Microsoft.SystemCenter.ManagementGroup if you\u2019re working under the covers). You can view them in the Operations Console with the following steps:<\/p>\n<ol>\n<li>Select <strong>Authoring<\/strong> workspace &gt; <strong>Rules<\/strong>.<\/li>\n<li>Click <strong>Change Scope<\/strong> in the top-right.<\/li>\n<li>Select <strong>View all targets<\/strong>.<\/li>\n<li>Type <em>management group<\/em> to filter the list and select <strong>Operations Manager Management Group<\/strong>.<\/li>\n<\/ol>\n<p>You should get a list of all rules targeted at the management group class, and you can see the two rules that interest us.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-02.png\"><img decoding=\"async\" width=\"300\" height=\"70\" class=\"alignnone size-medium wp-image-77564\" alt=\"Screenshot of management pack objects scoped to Operations Manager Management Group.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-02-300x70.png\" \/><\/a><\/p>\n<p>Create an override to disable each rule with the following steps:<\/p>\n<ol>\n<li>Right-click the rule and then select <strong>Overrides<\/strong> &gt; <strong>Override the Rule<\/strong> &gt; <strong>For all objects of class: Operations Manager Management Group<\/strong>.<\/li>\n<li>Select the <strong>Enabled<\/strong> property and change its override value to <strong>False<\/strong>.<\/li>\n<li>Select an existing <strong>destination management pack<\/strong> to store the new override or create a new one.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-03.png\"><img decoding=\"async\" width=\"300\" height=\"95\" class=\"alignnone size-medium wp-image-77573\" alt=\"Screenshot of an override that disables a rule.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-03-300x95.png\" \/><\/a><\/p>\n<p>You can follow the same process to set the value to <strong>True<\/strong> when you want to enable the rule again.<\/p>\n<p>Since the <strong>MPUpdate<\/strong> rule runs every 12 hours, you will probably want to decrease this time if you\u2019re going to enable it for a short period. Otherwise it may not have a chance to run during the time you have it enabled. For example, you might change its frequency to every 10 minutes (600 seconds) and enable it for an hour or so.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-04.png\"><img decoding=\"async\" width=\"300\" height=\"86\" class=\"alignnone size-medium wp-image-77582\" alt=\"Screenshot of the Override Properties and the frequency parameter.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-04-300x86.png\" \/><\/a><\/p>\n<h3>Automate the overrides<\/h3>\n<p>It\u2019s not difficult to enable and disable the rules to control the <strong>MPUpdate<\/strong> process, but there are quite a few clicks required. It would be helpful if we could automate it with a single command. Eventually, I\u2019d like to get this logic into a management pack so could control it entirely within SCOM. In the meantime, though, we should be able to use a Windows PowerShell script to control those overrides.<\/p>\n<p>Russ Slaten posted a great <a target=\"_blank\" href=\"http:\/\/blogs.msdn.com\/b\/rslaten\/archive\/2013\/07\/21\/create-overrides-in-scom-2012-with-powershell.aspx\">script to create overrides<\/a> a couple years ago that\u2019s perfect for this. This script will allow you to specify the rule to override, the property and desired value, and the management pack to store the override. It will even create that management pack if it doesn\u2019t already exist.<\/p>\n<p>The following example uses that script to enable the <strong>MPUpdate<\/strong> rule and store the override in a management pack named <strong>OMS.Overrides<\/strong>.<\/p>\n<p style=\"padding-left: 30px\">CreateOverride.ps1 \u2013ManagementServer scom01.contoso.com \u2013ManagementPackID OMS.Overrides \u2013WorkflowID Microsoft.SystemCenter.Advisor.MPUpdate \u2013ContextID Microsoft.SystemCenter.ManagementGroup \u2013PropertyName Enabled \u2013PropertyValue True \u2013Enforced False<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-05.png\"><img decoding=\"async\" width=\"300\" height=\"134\" class=\"alignnone size-medium wp-image-77584\" alt=\"Screenshot of results of a script that enables the MPUpdate rule and store the override.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-05-300x134.png\" \/><\/a><\/p>\n<h3>Schedule the script<\/h3>\n<p>It would be helpful to schedule this script to run at certain times so we can have updates occur only during a certain time window. For example, we might want to have the updates disabled by default, enable them at 1 AM each night, and disable them at 2 AM.<\/p>\n<p>As I mentioned before, I\u2019ll hopefully get this functionality into a management pack at some point. A simple method, though, is to schedule the script to run as a scheduled task on a management server. You could technically run it on any machine with the Operations Manager console binaries installed, but a management server makes sense since that\u2019s what the script has to connect to anyway.<\/p>\n<p>You can create a scheduled task in Windows by using <strong>Task Scheduler<\/strong>, which you access from <strong>Administrative Tools<\/strong>. The Scripting Guys wrote a great blog post on exactly how to <a target=\"_blank\" href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/08\/11\/weekend-scripter-use-the-windows-task-scheduler-to-run-a-windows-powershell-script\/\">Use the Windows Task Scheduler to Run a Windows PowerShell Script<\/a>, and that\u2019s exactly the method I\u2019ll use.<\/p>\n<p>Because we need to run the script for each rule, and we need to give it a pretty long list of parameters, I created two additional scripts to encapsulate the long command lines.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-06.png\"><img decoding=\"async\" width=\"300\" height=\"30\" class=\"alignnone size-medium wp-image-77594\" alt=\"Screenshot of parameters in the EnableOMSUpdates.ps1 script.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-06-300x30.png\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-07.png\"><img decoding=\"async\" width=\"300\" height=\"26\" class=\"alignnone size-medium wp-image-77604\" alt=\"Screenshot of parameters in the DisableOMSUpdates.ps1 script.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-07-300x26.png\" \/><\/a><\/p>\n<p>That simplifies the argument that I need to pass to powershell.exe in the action for my schedule task. You can\u2019t see it too well in the screenshot below, but the argument is <strong>\u2013file &#8220;c:\\scripts\\DisableOMSUpdates.ps1&#8221;<\/strong>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-08.png\"><img decoding=\"async\" width=\"300\" height=\"164\" class=\"alignnone size-medium wp-image-77612\" alt=\"Screenshot of the \u2013file &quot;c:\\scripts\\DisableOMSUpdates.ps1&quot; argument in the Edit Action dialog box for a scheduled task.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-08-300x164.png\" \/><\/a><\/p>\n<p>Create a scheduled task each for enable and disable to run at the appropriate time, and you\u2019re ready to go.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-09.png\"><img decoding=\"async\" width=\"300\" height=\"32\" class=\"alignnone size-medium wp-image-77613\" alt=\"Screenshot of the Enable and Disable scheduled tasks.\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/OMS-3-14-16-09-300x32.png\" \/><\/a><\/p>\n<p>I invite you to follow me on <a target=\"_blank\" href=\"https:\/\/twitter.com\/mpauthor\">Twitter<\/a> and keep an eye on our new <a target=\"_blank\" href=\"https:\/\/technet.microsoft.com\/en-us\/library\/mt691517.aspx\">Monitoring documentation<\/a> where we\u2019ll be presenting a variety of scenarios using OMS\u00a0and Operations Manager together.<\/p>\n<p><strong>Brian Wren<\/strong><\/p>\n<p>OMS Documentation Team<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to disable automatic management pack updates from MS OMS\u00a0to Operations Manager and limit updates to a specific time window. Hi all, Brian Wren here. I usually spend my time writing documentation for TechNet and Azure.com, but I\u2019ve been hearing about an issue from a few customers that I wanted to address. We\u2019re [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[672],"tags":[670,56,671,41,663,489],"class_list":["post-77553","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-operations-management-suite","tag-brian-wren","tag-guest-blogger","tag-log-analytics","tag-monitoring","tag-msoms","tag-system-center"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to disable automatic management pack updates from MS OMS\u00a0to Operations Manager and limit updates to a specific time window. Hi all, Brian Wren here. I usually spend my time writing documentation for TechNet and Azure.com, but I\u2019ve been hearing about an issue from a few customers that I wanted to address. We\u2019re [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/77553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=77553"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/77553\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=77553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=77553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=77553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}