<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>IT Manageability - Cory Delamarter</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/corydelamarter/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/corydelamarter/feed.xml</link>
    <description>My experiences, learning and occasional ramblings on manageability in IT</description>
    <lastBuildDate>Tue, 16 Apr 2019 06:01:32 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Performance data "missing" in the OpsMgr warehouse and Health Service Modules event 31553</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/performance-data-missing-in-the-opsmgr-warehouse-and-health-service-modules-event-31553</link>
      <pubDate>Tue, 12 Aug 2014 08:29:49 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2014/08/12/performance-data-missing-in-the-opsmgr-warehouse-and-health-service-modules-event-31553/</guid>
      <description><![CDATA[We had an odd issue happen, which resulted in many relatively new servers not having their...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family:Calibri;font-size:medium;">We had an odd issue happen, which resulted in many relatively new servers not having their performance data in OpsMgr data warehouse.&nbsp; Alongside this symptom, we kept seeing the following errors raised in the <b>Operations Manager</b> event log on our management servers:</span></p>
<p><span style="font-family:Calibri;font-size:medium;">Log Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Operations Manager<br /> Source:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>Health Service Modules</b><br /> Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8/8/2014 9:19:12 AM<br /> Event ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>31553</b><br /> Task Category: Data Warehouse<br /> Level:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error<br /> Keywords:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Classic<br /> User:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; N/A<br /> Computer:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt;Management Server Name&gt;&gt;<br /> <br /> Description:<br /> Data was written to the Data Warehouse staging area but processing failed on one of the subsequent operations.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">Exception </span><span style="font-family:Calibri;"><span style="font-size:medium;"><b>&#39;SqlException&#39;: Sql execution failed. Error 2627, Level 14, State 1, Procedure ManagedEntityChange, Line 368, Message: Violation of UNIQUE KEY constraint &#39;UN_ManagedEntityProperty_ManagedEntityRowIdFromDAteTime&#39;. Cannot insert duplicate key in object &#39;dbo.ManagedEntityProperty&#39;. The duplicate key value is (17512, Apr 26 2013&nbsp; 9:50AM). <br /> </b><br /> One or more workflows were affected by this.&nbsp; <br /> Workflow name: </span></span><span style="font-family:Calibri;"><span style="font-size:medium;"><b>Microsoft.SystemCenter.DataWarehouse.Synchronization.ManagedEntity<br /> </b>Instance name: c12a765d-2be4-404b-93fd-8ebc915d0dcc <br /> Instance ID: {D31B8D2C-1C84-1D9D-D22D-983C985AA572} <br /> Management group: &lt;&lt;MGName&gt;&gt;</span></span></p>
<p><span style="font-family:Calibri;font-size:medium;">The combination of event ID, event source and the specific exception test are important and anything else I talk about only applies to this particular combination.&nbsp; I say this because event ID 31553 can be raised for numerous exceptions and each one requires different steps.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">After reading over </span><a href="https://www.systemcentercentral.com/fixing-event-id-31553-on-scom-management-server/"><span style="color:#0563c1;font-family:Calibri;font-size:medium;">this post</span></a><span style="font-family:Calibri;font-size:medium;"> on SystemCenterCentral.com from Stanislav Zhelyazkov, I was fairly convinced we were up against the same problem and seeing as I didn&rsquo;t mind losing one or two rows of property changes, I decided to go along with the steps he provided and see if it helped.&nbsp; Well it did and it didn&rsquo;t.&nbsp; It did help, in that we did not see the same exception again, but it didn&rsquo;t help in that another exception of the same type (same ID, same SQL message, but a different duplicate key value) came up.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">In short, we had the problem that Stanislav described, but with an unforeseeable number of rows in the ManagedEntityProptery table.&nbsp; Ugh!</span></p>
<p><span style="font-family:Calibri;font-size:medium;">So what does any of it have to do with getting performance data into the warehouse?&nbsp; In order to answer that question, I had to do some digging into how the warehouse works and here is what I learned:</span></p>
<ul>
<li>
<p>Performance data can&rsquo;t be inserted into the warehouse for manage entities that don&rsquo;t exist in the warehouse yet</p>
</li>
<li>
<p>Much like the perf or state data sets, the managed entity data is put into a staging table, before it is officially processed into the warehouse ([dbo].[ManagedEntityStage])</p>
</li>
<li>
<p>We had a huge backlog of data in the staging table and nothing had been added to the live tables for months</p>
<ul>
<li>
<p>SELECT COUNT(*) FROM [dbo].[ManagedEntityStage] WITH(NOLOCK) -- backlog in the stage table</p>
</li>
<li>
<p>SELECT MAX(DWCreatedDateTime) FROM vManagedEntity -- most recent record in the live table</p>
</li>
</ul>
</li>
</ul>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">So how does one fix this issue?&nbsp; Call CSS is the official answer, but you can take Stanislav&rsquo;s steps and they will work.&nbsp; The side effect of deleting the row is that the given managed entity row property change will be replaced so if 100% data fidelity is a priority for you, then this is not a process you want to pursue.&nbsp; If you get into a situation like we did where there are numerous rows that are violating the key constraint though, then you&rsquo;re signing up for a lot of tedium, so calling CSS is really the best option as they can help and it will get the attention of the System Center Operations Manager product group if this does end up being a fairly common issue that CSS gets called about.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">What should we do to avoid this problem in the future?&nbsp; It&rsquo;s not clear how to prevent the root problem, but you can look for this problem and react before it gets out of hand.&nbsp; In short, the process that is responsible for moving the data from the staging to the live table is encountering an unexpected issue that isn&rsquo;t handled by the stored procedure (<b>[dbo].[ManagedEntityChange]</b>) and as a result the whole process rolls back.&nbsp; This will happen over and over again and nothing (that I&rsquo;ve seen at least) outside of manual intervention will fix it.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">So&hellip;</span></p>
<ul>
<li>
<p>Step 1: Set up some monitoring for event ID 31553 on your management servers and look specifically for the &ldquo;<b>Violation of UNIQUE KEY constraint &#39;UN_ManagedEntityProperty_ManagedEntityRowIdFromDAteTime&#39;</b>&rdquo; exception text</p>
</li>
<li>
<p>Step 2: If you see this event, check to see how big your ManagedEntityStage backlog is (query above)</p>
</li>
<li>
<p>Step 3: If the backlog is small and you have a reliable backup of your warehouse and you can accept the data fidelity concerns this raises, then consider the steps that Stanislav has outlined.&nbsp; Note: Any manual deletions will work but are entirely not supported so keep that in mind</p>
</li>
<li>
<p>Step 4: Call CSS, if budget allows</p>
</li>
</ul>
<p><span style="font-family:Calibri;font-size:medium;">Cheers,</span></p>
<p><span style="font-family:Calibri;font-size:medium;">Cory</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>]]></content:encoded>
    </item>
    <item>
      <title>how to analyze a workflow when the OpsMgr workflow Analyzer doesn't work</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/how-to-analyze-a-workflow-when-the-opsmgr-workflow-analyzer-doesnt-work</link>
      <pubDate>Thu, 31 Oct 2013 12:56:00 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2013/10/31/how-to-analyze-a-workflow-when-the-opsmgr-workflow-analyzer-doesnt-work/</guid>
      <description><![CDATA[For those of you that have done custom MP development, you know how mind boggling some of the errors...]]></description>
      <content:encoded><![CDATA[<p>For those of you that have done custom MP development, you know how mind boggling some of the errors can be and how difficult it is to get useful debug information on those failures.&nbsp; There was a resource kit tool that was released a while back which helped with this but that tool has not been updated in a while and as a result has stopped working in most places.</p>
<p>Fortunately J.C. Hornbeck has posted a guide on how to get this tracing working even if the tool itself wont work.</p>
<p>Check it out!</p>
<p><a href="https://blogs.technet.com/b/momteam/archive/2013/10/31/how-to-analyze-a-workflow-when-the-opsmgr-workflow-analyzer-doesn-t-work.aspx">https://blogs.technet.com/b/momteam/archive/2013/10/31/how-to-analyze-a-workflow-when-the-opsmgr-workflow-analyzer-doesn-t-work.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Using PowerView for OpsMgr data</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/using-powerview-for-opsmgr-data</link>
      <pubDate>Tue, 17 Sep 2013 13:42:29 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2013/09/17/using-powerview-for-opsmgr-data/</guid>
      <description><![CDATA[A number of months ago, I was introduced to Mark Drewfs who is a Premier Field Engineer (PFE) here...]]></description>
      <content:encoded><![CDATA[<p>A number of months ago, I was introduced to Mark Drewfs who is a Premier Field Engineer (PFE) here within Microsoft.&nbsp; We worked together for a number of weeks on some queries for OpsMgr data and then he used his PowerView skills to put together some really great views of the data.&nbsp; The result of his work is now something we can all benefit from.&nbsp; Check it out!</p>
<p>Event Data: <a href="https://blogs.technet.com/b/drewfs/archive/2013/08/10/event-reporting-with-power-view.aspx">https://blogs.technet.com/b/drewfs/archive/2013/08/10/event-reporting-with-power-view.aspx</a></p>
<p>Alert Data: <a href="https://blogs.technet.com/b/drewfs/archive/2013/08/19/alert-reporting-with-power-view.aspx">https://blogs.technet.com/b/drewfs/archive/2013/08/19/alert-reporting-with-power-view.aspx</a></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>OpsMgr 2012 PowerShell: Management and Gateway Servers</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/opsmgr-2012-powershell-management-and-gateway-servers</link>
      <pubDate>Fri, 15 Mar 2013 09:38:00 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2013/03/15/opsmgr-2012-powershell-management-and-gateway-servers/</guid>
      <description><![CDATA[Quick Reference
In the previous post I talked about how to get connected to management...]]></description>
      <content:encoded><![CDATA[<p><a href="https://blogs.technet.com/b/corydelamarter/archive/2013/01/17/opsmgr-2012-powershell-quick-reference.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">Quick Reference</span></a></p>
<p><span style="font-family: Calibri; font-size: small;">In the </span><a href="https://blogs.technet.com/b/corydelamarter/archive/2013/02/08/opsmgr-2012-powershell-getting-connected.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">previous</span></a><span style="font-size: small;"><span style="font-family: Calibri;"> post I talked about how to get connected to management groups.&nbsp; In this post I&rsquo;m going to talk about working with management servers and gateway servers. &nbsp;I will also introduce you to a script that I wrote, which gives a hierarchical view of state, much like the health explorer in the console.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Following are some useful ways that I&rsquo;ve found to work with the management and gateway servers via PowerShell:</span></span></p>
<ul>
<li><span style="font-size: small;"><span style="font-family: Calibri;">Check to see which servers are running which types of roles (e.g. the RMS emulator, the gateway server role, etc.)</span></span></li>
<li><span style="font-size: small;"><span style="font-family: Calibri;">Ensure the base configurations (i.e. action account, version, for your servers are correct</span></span></li>
<li><span style="font-size: small;"><span style="font-family: Calibri;">Check which agents are managed by the server and vice versa</span></span></li>
<li><span style="font-size: small;"><span style="font-family: Calibri;">Make sure all of your servers are healthy and figure what&rsquo;s wrong with them if they are not</span></span></li>
</ul>
<p><span style="font-size: small;"><span style="font-family: Calibri;">In order to see the cmdlets that you&rsquo;ll work with in the OperationsManager PowerShell module, for management and gateway servers, run the following command:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">get-command -module operationsmanager -Noun *ManagementServer</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">That will return four cmdlets.&nbsp; The first two cmdlets (<strong>Get-SCOMGatewayManagementServer</strong> and <strong>Get-SCOMManagementServer</strong>) are used to get list of gateway or management servers based.&nbsp; You can either get the list of all of them for a given MG by providing no parameters or you can use the <strong>-ComputerName</strong> or <strong>&ndash;Name</strong> parameters to look for servers that have particular names or substrings within their names, respectively.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The first thing to note is that gateway servers are really considered a type of management server in Operations Manager.&nbsp; As such, if you run the following cmdlet against a management group that has both gateway servers and management servers, you&rsquo;ll get back a list that contains both types of servers:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementServer</span></p>
<p><span style="font-family: Calibri; font-size: small;">If you pipe the <strong>Get-SCOMManagementServer</strong> cmdlet into <strong>Get-Member</strong> you see that is returns objects of type </span><a href="https://msdn.microsoft.com/en-us/library/bb465408.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">Microsoft.EnterpriseManagement.Administration.ManagementServer</span></a><span style="font-size: small;"><span style="font-family: Calibri;">. </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementServer | get-member</span></p>
<p><span style="font-family: Calibri; font-size: small;">What&rsquo;s more relevant though is if we look at the </span><a href="https://msdn.microsoft.com/en-us/library/microsoft.enterprisemanagement.administration.managementserver_members.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">members</span></a><span style="font-size: small;"><span style="font-family: Calibri;"> of that class, which includes many properties and a few methods that are relevant to our common needs.&nbsp; For instance, since the default output of <strong>Get-SCOMManagementServer</strong> doesn&rsquo;t distinguish between the two types of servers, we need to take matters into our own hands to figure that out:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementServer | format-table HealthState, Name, Version, ActionAccountIdentity, IsGateway,IsRootManagementServer &ndash;AutoSize</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">And that how I address the first use mentioned above.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The second use is for ensuring the base configurations are set the way we want them to be.&nbsp; Base configurations, for me, include the following:</span></span></p>
<ul>
<li><span style="font-size: small;"><span style="font-family: Calibri;"><strong>ActionAccountIdentity</strong>: If this changes you may not be able to complete agent maintenance in the way you expect.</span></span></li>
<li><span style="font-size: small;"><span style="font-family: Calibri;"><strong>AutoApproveManuallyInstallAgents/RejectManuallyInstalledAgents</strong>:&nbsp; I won&rsquo;t weigh in on which setting is the best, but each team prefers one way or the other so it&rsquo;s important to confirm it doesn&rsquo;t change</span></span></li>
<li><span style="font-size: small;"><span style="font-family: Calibri;"><strong>MissingHeartbeatThreshold</strong> and <strong>HeartbeatInterval</strong>: The first is the number of heartbeats that can go missing before an agent will be flagged as missing heartbeats in the management group.&nbsp; The second is the amount of time (seconds) that is allowed between heartbeats.&nbsp; When a system doesn&rsquo;t send in a heartbeat for <strong>HeartBeatInterval*MissingHeartBeatThreshold </strong>seconds the Heartbeat missing monitor gets flipped which can generate alerts.&nbsp; It also triggers the computer down monitoring.&nbsp; Set these values too low and you&rsquo;ll be dealing with a bunch of false positive alerts.&nbsp; Turn these up too high and you might not know about servers that are offline, soon enough.&nbsp; Have them set differently on different servers and things can get really confusing.</span></span></li>
</ul>
<p><span style="font-size: small;"><span style="font-family: Calibri;">So, for instance, to detect systems with a bad <strong>ActionAccountIdentity</strong>, you would do the following:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># Get the action account that should be used<br /> $CorrectRunAs = Get-SCOMRunAsAccount -Name &lsquo;YourAccountNameHere&rsquo; | where-object {$_.AccountType -eq 'SCOMActionAccountSecureData'}<br /> <br /> # Get the management server(s) that are not using that account<br /> Get-SCOMManagementServer | where-object{$_.ActionAccountIdentity -ne $CorrectRunAs.Name}</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><span style="text-decoration: underline;">Side note</span>:&nbsp; I tried to programmatically set the default action account (code that doesn&rsquo;t work below), but apparently the SDK treats the default run as profile as a special case so we can&rsquo;t do that any other way accept via the OpsMgr console.&nbsp; I&rsquo;m sharing this non-working code though in hopes that someone will find it useful.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># This will fail because OpsMgr SDK blocks changes to the default profile<br /> # Wouldn&rsquo;t it be nice if it worked?&nbsp; Hopefully this is useful&hellip;<br /> foreach ($IncorrectServer in $IncorrectServers) {Set-SCOMRunAsProfile -Instance $IncorrectServer.HostedHealthService -Account $RunAs -Profile $DefaultRunAsProfile}</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">This brings us to our third use, which is making the connection between agents their management and gateway servers and vice versa.&nbsp; Here are some commands that I find useful</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># Show the list of management servers, their health state and how many agents they manage<br /> get-scommanagementserver | ft -Property Name, HealthState, @{Name='Agent Count'; Expression={$_.GetAgentManagedComputers().Count}} &ndash;AutoSize<br /> <br /> # Get the list of agents reporting to a server<br /> $Agents = (get-SCOMManagementServer -Name &lsquo;YourServerName&rsquo;).GetAgentManagedComputers()<br /> <br /> # Show just the agents from that server that are not healthy<br /> # Note: Use the HostedHealthService property to look at the real agent state.<br /> $Agents.HostedHealthService | where-object{$_.HealthState -ne 'Success'}<br /> <br /> # Given an agent, find the parent management or gateway server(s)<br /> Get-SCOMAgent &ndash;Name &ldquo;YourAgentName&rdquo; | Get-SCOMParentManagementServer</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The last use is making sure all of our servers are healthy and figuring what&rsquo;s wrong with them if they are not.&nbsp; The command for getting the unhealthy servers is easy enough:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">$UnhealthyServers = get-SCOMManagementServer | where-object{$_.HealthState -ne 'Success'}</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The part that&rsquo;s tricky is getting an understanding of why each server is unhealthy.&nbsp; This is tricky (or non-obvious at least) for two reasons.&nbsp; The first is we have to get the hosted health service for each server, which is where the real state of the management server is held.&nbsp; Doing that is not hard, but it&rsquo;s also not obvious.&nbsp; </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">$UnhealthyServers | foreach-object{$_.HostedHealthService}</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The second part is that we need something like the health explorer from the operations console in PowerShell, where we can pass in a health service and get back a hierarchical view of the state of that object.&nbsp; For that I had to create something.&nbsp; </span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The attached PS1 file (Write-SCOMMonitoringStateHierarchy.ps1) contains two functions.&nbsp; The first function (<strong>Write-SCOMMonitoringStateHierarchy</strong>) takes in a hierarchy and then uses the second function (<strong>Write-SCOMMonitoringState</strong>) to write that hierarchy out to the screen.&nbsp; In order to make the view a bit more useful the functions will display warning and error states as yellow and red respectively.&nbsp; Also, they do not show monitors that are uninitialized (the empty green circle in the UI).</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">To use the functions download the PS1 file, save it to some location on your system (&ldquo;FullPathToFile&rdquo;) and then do the following:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># load the functions up into your session<br /> . FullPathToFile\Write-SCOMMonitoringStateHierarchy.ps1<br /> <br /> # Get the hosted health services, from those get the hierarchies <br /> #&nbsp; and with those do the output to the screen<br /> $UnhealthyServers | foreach-object{$_.HostedHealthService} | foreach-object{$_.GetMonitoringStateHierarchy()} | Write-SCOMMonitoringStateHierarchy</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">And that covers the topic of management and gateway servers.&nbsp; Next time I&rsquo;ll start working with agents.&nbsp; The topic of getting agents installed and removed with PowerShell is pretty well covered in other places so we&rsquo;ll probably breeze over that fast and get into topics around keeping them healthy and well configured.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Cheers until then,<br /></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Cory</span></span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/telligent.evolution.components.attachments/01/8725/00/00/03/55/89/66/Write-SCOMMonitoringStateHierarchy.ps1" original-url="https://blogs.technet.com/cfs-filesystemfile.ashx/__key/telligent-evolution-components-attachments/01-8725-00-00-03-55-89-66/Write_2D00_SCOMMonitoringStateHierarchy.ps1">Write-SCOMMonitoringStateHierarchy.ps1</a></p>]]></content:encoded>
    </item>
    <item>
      <title>OpsMgr 2012 PowerShell: Getting Connected</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/opsmgr-2012-powershell-getting-connected</link>
      <pubDate>Fri, 08 Feb 2013 15:24:33 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2013/02/08/opsmgr-2012-powershell-getting-connected/</guid>
      <description><![CDATA[Quick Reference
In the previous post, I introduced the OpsMgr 2012 PowerShell module and discussed...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;"><span style="font-family: Calibri;"><a title="OpsMgr 2012 PowerShell: Quick Reference" href="https://blogs.technet.com/b/corydelamarter/archive/2013/01/17/opsmgr-2012-powershell-quick-reference.aspx" target="_blank">Quick Reference</a></span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">In the <a title="OpsMgr 2012 PowerShell: Getting Oriented" href="https://blogs.technet.com/b/corydelamarter/archive/2013/01/17/opsmgr-2012-powershell-getting-oriented.aspx" target="_blank">previous post</a>, I introduced the OpsMgr 2012 PowerShell module and discussed a few of the ways that I used to get oriented to it.&nbsp; Now that we&rsquo;re oriented, the first thing I want to explore is how connections work.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Both the previous and the current PowerShell implementations for OpsMgr support remotely connecting to one or more management groups.&nbsp; This is cool for a couple reasons. &nbsp;The first is I can open up PowerShell on my desktop and run cmdlets without having to TS onto a bunch of servers.&nbsp; The second is that I can connect to <span style="text-decoration: underline;">multiple</span> management groups, which comes in use when I want to compare/align two or more environments together or I want to get data from all of my environments at once.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><strong>Note:</strong> The OpsMgr 2012 module does not support connecting to down-level versions of OpsMgr.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">To get familiar with how this works in the OpsMgr 2012 module, run the following command to see the four cmdlets that relate to management group connections.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">get-command -module operationsmanager -noun SCOMManagementGroupConnection</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><strong>Note</strong>: You may notice that the <strong><span style="text-decoration: underline;">SCOM</span></strong>ManagementGroupConnection noun (starting with SCOM) is actually an alias for cmdlets that use the <strong>SC</strong>ManagementGroupConnection noun (starting with SC, for system center).&nbsp; I use the SCOM specific aliases, but either nouns would work the same.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Likewise, there is an about topic that discusses how the connections work.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">get-help about_OpsMgr_Connections | more</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">You could also review the help content provided on each cmdlet to get familiar with them.&nbsp; With that said, the examples provided only go so deep.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The first step is to create a connection.&nbsp; As the about topic mentions, there are a couple kinds of connection types to work with; persistent and temporary.&nbsp; Connections that are created as persistent are held in the state of the PowerShell session, whereas temporary connections are tied to the execution of a specific cmdlet and live only as long as the resulting objects are in state.&nbsp; The only distinction here is whether you use the <strong>New-SCOMManagementGroupConnection</strong> to create the connection (persistent) or if you use the <strong>-ComputerName</strong> (and optionally <strong>-Credentials</strong>) parameter to get connected (temporary).</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">We&rsquo;ll start by walking through persistent connections and then I&rsquo;ll cover the one use I&rsquo;m aware of for temporary connections.</span></span></p>
<p><strong><span style="font-size: small;"><span style="font-family: Calibri;">Setting up the connection</span></span></strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">In order to create a persistent connection, run the <strong>New-SCOMManagementGroupConnection</strong> cmdlet.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">New-SCOMManagementGroupConnection -ComputerName &lt;OpsMgrServerName&gt;</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The value of </span>&lt;OpsMgrServerName&gt; <span style="font-family: Calibri;">can be any OpsMgr 2012 server that is running the OpsMgr SDK service.&nbsp; Since the SDK service is running on any management server in an OpsMgr 2012 management group, this gives us a lot more flexibility than in 2007 R2, where we could connect to the RMS only.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">If the cmdlet produces no output, then you know you did it right.&nbsp; If you want the cmdlet to return the connection object that it creates, you can include the <strong>&ndash;Passthru</strong> parameter when you run the cmdlet.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">If you need to connect to multiple management groups, you keep running the NEW cmdlet for each management group or management server you want to connect to.&nbsp; This is a big improvement over <a title="Using the Operations Manager Command Shell against multiple management groups" href="https://blogs.technet.com/b/corydelamarter/archive/2011/03/25/using-the-operations-manager-command-shell-against-multiple-management-groups.aspx" target="_blank">what you had to do in </a></span><span style="font-family: Calibri; font-size: small;"><a title="Using the Operations Manager Command Shell against multiple management groups" href="https://blogs.technet.com/b/corydelamarter/archive/2011/03/25/using-the-operations-manager-command-shell-against-multiple-management-groups.aspx" target="_blank">2007 R2</a></span><span style="font-size: small;"><span style="font-family: Calibri;">.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Once your connections are created, you can run the <strong>Get-</strong><strong>SCOMManagementGroupConnection</strong> cmdlet to see the persistent connections that you&rsquo;ve created.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The most important column in the output is the <strong>IsActive</strong> column.&nbsp; This bit indicates which connection is the default connection.&nbsp; The default connection is the connection that will be implicitly used by all cmdlets.&nbsp; You can run cmdlets against non-active connections, but in those cases you&rsquo;ll either have to switch which connection is active or pass in the connection details explicitly.&nbsp; I&rsquo;ll cover that scenario further down.</span></span></p>
<p><strong><span style="font-size: small;"><span style="font-family: Calibri;">Using the connection</span></span></strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">In most cases, creating one persistent connection is the first and last thing you&rsquo;ll do with the connection directly.&nbsp; I say that because once a persistent connection is established all cmdlets just work, and they run against the connection flagged as &ldquo;TRUE&rdquo; for <strong>IsActive</strong>.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The reason this works is that every cmdlet in the OpsMgr 2012 module includes a parameter named <strong>SCSession</strong> which takes in an array of type <strong>Connection</strong>.&nbsp; If the cmdlet is not explicitly passed a connection object, then it will look in state for a connection with the <strong>IsActive</strong> bit set to TRUE and it will implicitly work with that.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">If you needed to explicitly pass in a connection to a cmdlet you need to first get the connection and then pass it into the cmdlet(s).&nbsp; For example, you would do the following to get the connection for a specific management group and then use it to get alerts from that management group.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">$connection = Get-SCOMManagementGroupConnection &ndash;ManagementGroupName &ldquo;MyGroup&rdquo;<br /> <br /> Get-SCOMAlert &ndash;SCSession $connection</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">An interesting (to me at least) side effect of the way connections work in relation to cmdlets in this module, is that every object that comes out of a cmdlet holds onto its own little connection back to the management group it was pulled from.&nbsp; You can see this if you run <strong>Get-Member</strong>, in that there is a <strong>ManagementGroup</strong> property on almost every object type that can come out of a cmdlet in the OpsMgr module.&nbsp; That property is of type Microsoft.EnterpriseManagement.ManagementGroup, which is the object type used in the OpsMgr SDK to hold a connection.&nbsp; You can test this out yourself by doing the following:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">## Create the connection<br /> New-SCOMManagementGroupConnection &ndash;ComputerName &ldquo;MyServer&rdquo;</span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">## Get alerts implicitly using the connection<br /> $alerts = Get-SCOMAlert</span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">## Check out the ManagementGroup property on an alert<br /> $alerts[0] | select-object -Property ManagementGroup | get-member</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">What this means to you, is that even if the connection that was used in the cmdlet to get the objects gets blown away, the object itself will still be able to interact with the management group, through this mini-connection is carries around.</span></span></p>
<p><strong><span style="font-size: small;"><span style="font-family: Calibri;">Working with multiple connections</span></span></strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">But what if you have more than one management group you want to work with?&nbsp; Maybe you&rsquo;ve got a pre-prod environment that you want to copy settings or management packs from.&nbsp; Maybe you&rsquo;ve got scale or security requirements so you needed to deploy more than one MG in order to scale, but you want to see the data from all of those environments in one place.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">As I mentioned previously, you create multiple connections by running the New-<strong>SCOMManagementGroupConnection</strong> cmdlet.&nbsp; Once you&rsquo;ve created all of the connections you need you can use the <strong>Get-SCOMManagementGroupConnection</strong> cmdlet to see them all.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The GET cmdlet also has a few parameters for filtering the connections that are returned.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><span style="text-decoration: underline;">Id</span>:&nbsp; This is a GUID that uniquely identifies the connection.&nbsp; The ID column is not shown in the default output so you&rsquo;ll need to get at it if you need it.&nbsp; The easiest way to do that is by piping the GET cmdlet to &ldquo;<strong>Select-Object &ndash;Property ID</strong>&rdquo;, but any standard PoSH approach will work.&nbsp; This will come in use when we want to set a different connection as active.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection | select-object -Property ID<br /> <br /> Id<br /> --<br /> e67d872b-815f-4d27-a812-a29a9a6fa438<br /> a407c6d6-3feb-452a-aeb0-16d9f50ad44a<br /> 6d87b620-447d-40b1-ba68-1745c672676c</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><span style="text-decoration: underline;">ManagementGroupName</span>: Get all connections that exist with the given management group.&nbsp; This is just a string and it does support typical wildcards.&nbsp; This comes in use if you have to connect to multiple management groups and you have a predictable MG naming scheme.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection -ManagementGroup "OMCOR2" | format-table ManagementServerName, IsActive &ndash;Auto<br /> <br /> ManagementServerName IsActive<br /> -------------------- --------<br /> OMServer1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; True<br /> OMServer2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; False</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><span style="text-decoration: underline;">ComputerName</span>:&nbsp; Get all connections that exist with the given ComputerName, which would be the name of a management server.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection -ComputerName OMServer1 | format-table ManagementServerName, IsActive &ndash;Auto<br /> <br /> ManagementServerName IsActive<br /> -------------------- --------<br /> OMServer1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; True</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">If you need to change which connection is active you can get the connection you want and then use the <strong>Set-SCOMManagementGroupConnection</strong> cmdlet to set it to active.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection &ndash;Id e67d872b-815f-4d27-a812-a29a9a6fa438 | Set-SCOMManagementGroupConnection</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><strong>Note</strong>: You can use any parameter you want to on the GET cmdlet, to get a connection, but the ID parameter is the only one that is guaranteed to return one and only one object.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Now that the connections are created you can use them in a couple of ways.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The first way you can use them is to get details from one source management group and then apply those settings to other management groups.&nbsp; </span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># Get the source connection<br /> $Source = Get-SCOMManagementGroupConnection -ComputerName &ldquo;OMServer1&rdquo;<br /> <br /> # Get all other connections<br /> $Target = Get-SCOMManagementGroupConnection | Where-Object{$_.ManagementServerName -ne "OMServer1"}</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Now you can do things like the following:</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># Sync the Database grooming settings<br /> Get-SCOMDatabaseGroomingSetting -SCSession $Source | Set-SCOMDatabaseGroomingSetting -SCSession $Target <br /> <br /> # See which management packs are not the same between MGs<br /> Compare-Object -ReferenceObject (Get-SCOMManagementPack -SCSession $Source) -DifferenceObject (Get-SCOMManagementPack -SCSession $Target)</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">The second way you can use multiple connections is to get the same set of details from all connections at the same time.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;"># Get all connections into an object<br /> $Connections = Get-SCOMManagementGroupConnection<br /> <br /> # Get alerts from all connections<br /> Get-SCOMAlert -SCSession ($Connections)<br /> <br /> # Get all pending management actions and clear them out (Deny)<br /> Get-SCOMPendingManagement -SCSession ($Connections) | Deny-SCOMPendingManagement</span></p>
<p><strong><span style="font-size: small;"><span style="font-family: Calibri;">Closing connections</span></span></strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">If you need to remove a connection you again use the GET cmdlet to get the connection and then you pipe that into the <strong>Remove-SCOMManagementGroupConnection</strong> cmdlet.</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection &ndash;Id e67d872b-815f-4d27-a812-a29a9a6fa438 | Remove-SCOMManagementGroupConnection</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;"><strong>Note</strong>: You can use any parameter you want to on the GET cmdlet, to get a connection, but the ID parameter is the only one that is guaranteed to return one and only one object.&nbsp; This is especially important in this case since the REMOVE cmdlet will dutifully remove all connections that get passed into it.&nbsp; You&rsquo;ve been warned.</span></span></p>
<p><strong><span style="font-size: small;"><span style="font-family: Calibri;">Working with temporary connections</span></span></strong></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Earlier I mentioned there are two types of connections.&nbsp; The entire post thus far has discussed persistent connections.&nbsp; The other type of connection is a temporary connection.&nbsp; Instead of using the NEW cmdlet to create a connection and then implicitly or explicitly using those connections, temporary connections are created when a cmdlet is run with the <strong>&ndash;ComputerName</strong> and <strong>&ndash;Credential</strong> parameters.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">I don&rsquo;t use these at all myself (so I can&rsquo;t speak from personal experience), but from what I&rsquo;ve gathered these parameters come in use when you are running a one-liner via a direct call to PowerShell.exe</span></span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: small;">PowerShell.exe -Command "&amp; {import-module operationsmanager; Get-SCOMAlert -ComputerName OMServer1}"</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">So that&rsquo;s what I know about connections.&nbsp; Next time I get a chance to kick out a blog post I&rsquo;ll talk about working with management and gateway servers via PowerShell. &nbsp;I&rsquo;ll try to dabble into agent topics there too, but I suspect that will merit an entirely separate post.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Cheers until then,<br /> Cory</span></span></p>
<div>
<div>
<div>
<p><span style="font-family: Calibri; font-size: x-small;">&nbsp;</span></p>
</div>
</div>
</div>]]></content:encoded>
    </item>
    <item>
      <title>OpsMgr 2012 PowerShell: Getting Oriented</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/opsmgr-2012-powershell-getting-oriented</link>
      <pubDate>Thu, 17 Jan 2013 12:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2013/01/17/opsmgr-2012-powershell-getting-oriented/</guid>
      <description><![CDATA[Quick Reference
As some of you may already know the PowerShell support in OpsMgr 2012 changed...]]></description>
      <content:encoded><![CDATA[<p><a title="Quick Reference" href="https://blogs.technet.com/b/corydelamarter/archive/2013/01/17/opsmgr-2012-powershell-quick-reference.aspx" target="_blank">Quick Reference</a></p>
<p>As some of you may already know the PowerShell support in OpsMgr 2012 changed significantly from OpsMgr 2007 R2.&nbsp;For starters, the cmdlets are no longer an optional part of the UI install.&nbsp; It used to be you could select whether or not to install the PowerShell interface, when you installed the operations console, but now it installs automatically, every time you install the UI.</p>
<p>Secondly, and more importantly, the implementation is totally different.&nbsp; This is good in that it was built from scratch for PowerShell 2.0 (and beyond) and it does away with a few of the bad practices that existed in OpsMgr 2007 R2 (i.e. the navigational provider for the instance space).&nbsp; It is also bad in that much of what we had in the past will not work and in some important ways the behavior has changed for the worse.</p>
<p>In my upcoming posts I will explore the OpsMgr 2012 PowerShell module and share common ways for using the cmdlets.</p>
<p>So let&rsquo;s get started&hellip;</p>
<p>The first step is to import the module.&nbsp; If you&rsquo;ve already got PowerShell 3.0 installed then you can skip this step, but let&rsquo;s cover it for completeness<br />sake.&nbsp; Open an instance of PowerShell, and run the following:</p>
<p style="padding-left: 30px;"><strong><span style="font-family: courier new,courier;">import-module operationsmanager</span></strong></p>
<p>If you get no output and you just see the prompt on the next<br />line, then everything worked and now the module is loaded.&nbsp; From there run the following command to see<br />the &ldquo;about_&rdquo; help topics that ship with the module:</p>
<p style="padding-left: 30px;"><strong><span style="font-family: courier new,courier;">get-help OpsMgr</span></strong></p>
<p>For getting started, I&rsquo;d recommend reviewing at least the<br />following:</p>
<p style="padding-left: 30px;"><strong><span style="font-family: courier new,courier;">get-help about_OpsMgr_WhatsNew | more<br /></span><span style="font-family: courier new,courier;">get-help about_OpsMgr_Cmdlet_Names | more</span></strong></p>
<p><strong>Note</strong>:&nbsp; As the What&rsquo;s New topic points out, everything in this module will only work with OpsMgr 2012.&nbsp; If you want to programmatically work with 2007 R2 then the What&rsquo;s New topic walks you through how to do that and you&rsquo;ll need to use your old scripts and one-liners to do it.&nbsp; All the more reason to get to one version quickly :).</p>
<p>Next, get the full list of cmdlets that are included with the OperationsManager module by running the following:</p>
<p style="padding-left: 30px;"><strong><span style="font-family: courier new,courier;">get-command -module operationsmanager | more</span></strong></p>
<p>If you find a cmdlet that is of interest to you and you want to learn more about what it does and how to use it, you can go any of the following</p>
<p style="padding-left: 30px;"><strong><span style="font-family: courier new,courier;">get-help &lt;cmdletName&gt; -detailed | more</span></strong><br />This will provide the help content for the cmdlet, including the examples.</p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;"><strong>get-help &lt;cmdletName&gt; -full | more<br /></strong></span>This will provide the verbose details on the parameters that are available for the cmdlet.</p>
<p style="padding-left: 30px;"><strong><span style="font-family: courier new,courier;">&lt;cmdletName&gt; | Get-Member<br /></span></strong>This will show you the possible type(s) that a given cmdlet can return and what the methods and properties are on those types.&nbsp; This is especially useful for figuring out what you can use in pipelining cmdlets together.</p>
<p>In the next post I&rsquo;ll write about the new way in which the OpsMgr 2012 module handles connections.</p>
<p>Cheers until then,<br />Cory</p>]]></content:encoded>
    </item>
    <item>
      <title>OpsMgr 2012 PowerShell: Quick Reference</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/opsmgr-2012-powershell-quick-reference</link>
      <pubDate>Thu, 17 Jan 2013 12:46:00 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2013/01/17/opsmgr-2012-powershell-quick-reference/</guid>
      <description><![CDATA[OpsMgr 2012 PowerShell: Quick Reference
I will use this post to summarize all commands, one-liners...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;"><span style="font-family: Calibri;">OpsMgr 2012 PowerShell: Quick Reference</span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">I will use this post to summarize all commands, one-liners and short scripts that I identify overtime for PowerShell against OpsMgr 2012</span></span></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="2" valign="top" width="623">
<h1><a href="https://blogs.technet.com/b/corydelamarter/archive/2013/01/17/opsmgr-2012-powershell-getting-oriented.aspx"><span style="color: #0563c1; font-family: Calibri;">Getting Oriented</span></a></h1>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Import-module OperationsManager</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Adds the module into your session so that you can run the OpsMgr cmdlets.&nbsp; Not required in PowerShell v3</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-Help OpsMgr</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Shows the about topics provided with the OperationsManager module</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-Help about_OpsMgr_WhatsNew | more</span></p>
<p><span style="font-family: courier new,courier; font-size: small;">&nbsp;</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Shows the &ldquo;What&rsquo;s New&rdquo; topic one page at a time.&nbsp; This topic gives a good overview of what was added and how it differs from the 2007 R2 interface</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">get-help about_OpsMgr_Cmdlet_Names | more</span></p>
<p><span style="font-family: courier new,courier; font-size: small;">&nbsp;</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Shows the cmdlet names topic one page at a time.&nbsp; This topic gives a good overview of how cmdlets are named and how the names align to the 2007 R2 cmdlets</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">get-command -module operationsmanager | more</span></p>
<p><span style="font-family: courier new,courier; font-size: small;">&nbsp;</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Lists all commands provided with the OpsMgr 2012 module</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-help &lt;cmdletName&gt; -detailed | more</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">This will provide the help content for the cmdlet, including the examples.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-help &lt;cmdletName&gt; -full| more</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">This will provide the verbose details on the parameters that are available for the cmdlet.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">&lt;cmdletName&gt; | Get-Member</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">This will show you the possible type(s) that a given cmdlet can return and what the methods and properties are on those types.&nbsp; This is especially useful for figuring out what you can use in pipelining cmdlets together.</span></span></p>
</td>
</tr>
<tr>
<td colspan="2" valign="top" width="623">
<h1><a href="https://blogs.technet.com/b/corydelamarter/archive/2013/02/08/opsmgr-2012-powershell-getting-connected.aspx"><span style="color: #0563c1; font-family: Calibri;">Getting Connected</span></a></h1>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">get-command -module operationsmanager -noun SCOMManagementGroupConnection</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get all cmdlets that are related to working with management group connections</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">get-help about_OpsMgr_Connections | more</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Shows the about topic&rsquo;s content related to connections</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">New-SCOMManagementGroupConnection -ComputerName &lt;OpsMgrServerName&gt;</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Creates a new persistent connection to a management group</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Get all connections</span></p>
<p><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection<br /> <br /> </span></p>
<p><span style="font-family: courier new,courier; font-size: small;"># Get all connections and just show their ID<br /> Get-SCOMManagementGroupConnection | select-object -Property ID<br /> <br /> </span></p>
<p><span style="font-family: courier new,courier; font-size: small;"># Get all connections to a specific MG and show server and whether the connection is the Active one<br /> Get-SCOMManagementGroupConnection -ManagementGroup "OMCOR2" | format-table ManagementServerName, IsActive &ndash;Auto</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Use the GET cmdlet to get one or more persistent connections</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection &ndash;Id e67d872b-815f-4d27-a812-a29a9a6fa438 | Set-SCOMManagementGroupConnection</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get a specific connection by its unique ID and set it to be the active connection</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementGroupConnection &ndash;Id e67d872b-815f-4d27-a812-a29a9a6fa438 | Remove-SCOMManagementGroupConnection</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get a specific connection by its unique ID and remove it</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">$connection = Get-SCOMManagementGroupConnection &ndash;ManagementGroupName &ldquo;MyGroup&rdquo;<br /> <br /> Get-SCOMAlert &ndash;SCSession $connection</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get a connection to the management group named &ldquo;MyGroup&rdquo; and then explicitly use that connection to get alerts</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Create the connection<br /> New-SCOMManagementGroupConnection &ndash;ComputerName &ldquo;MyServer&rdquo;<br /> <br /> # Get alerts implicitly using the connection<br /> $alerts = Get-SCOMAlert<br /> <br /> # Check out the ManagementGroup property on an alert<br /> $alerts[0] | select-object -Property ManagementGroup | get-member</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get a connection to the management server named &ldquo;MyServer&rdquo; and then implicitly use that connection to get alerts.&nbsp; <br /> <br /> The management group property on each alert object hold a small connection back to the MG it came from.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Get the source connection<br /> $Source = Get-SCOMManagementGroupConnection -ComputerName &ldquo;OMServer1&rdquo;<br /> <br /> # Get all other connections<br /> $Target = Get-SCOMManagementGroupConnection | Where-Object{$_.ManagementServerName -ne "OMServer1"}</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">When working with multiple management groups and one group is a source, store that connection into one object and then put all other connections into another object.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Sync the Database grooming settings<br /> Get-SCOMDatabaseGroomingSetting -SCSession $Source | Set-SCOMDatabaseGroomingSetting -SCSession $Target</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get the grooming settings from a source management group and replicate those settings (set) across multiple target management groups.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># See which management packs are not the same between MGs<br /> Compare-Object -ReferenceObject (Get-SCOMManagementPack -SCSession $Source) -DifferenceObject (Get-SCOMManagementPack -SCSession $Target)</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Compare the management packs between a source management group and a target management group.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Get all connections into an object<br /> $Connections = Get-SCOMManagementGroupConnection<br /> <br /> # Get alerts from all connections<br /> Get-SCOMAlert -SCSession ($Connections)<br /> <br /> # Get all pending management actions and clear them out (Deny)<br /> Get-SCOMPendingManagement -SCSession ($Connections) | Deny-SCOMPendingManagement</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">When working with multiple management groups, get the same data across all management groups.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get all alerts across multiple management groups.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get all pending management actions across multiple management groups and clear (deny) them all.</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">PowerShell.exe -Command "&amp; {import-module operationsmanager; Get-SCOMAlert -ComputerName OMServer1}"</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Pass a one-liner into PowerShell.exe and leverage a temporary connection to get a list of all alerts from a single management group.</span></span></p>
</td>
</tr>
<tr>
<td colspan="2" valign="top" width="623">
<h1><a href="https://blogs.technet.com/b/corydelamarter/archive/2013/03/15/opsmgr-2012-powershell-management-and-gateway-servers.aspx"><span style="color: #0563c1; font-family: Calibri;">Management and Gateway Servers</span></a></h1>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">get-command -module operationsmanager -Noun *ManagementServer</span></p>
<p><span style="font-family: courier new,courier; font-size: small;">&nbsp;</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get all cmdlets related to management and gateway servers</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementServer</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get all management and gateway servers</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementServer | get-member</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Review the member properties and methods of the management server object</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">Get-SCOMManagementServer | format-table HealthState, Name, Version, ActionAccountIdentity, IsGateway,IsRootManagementServer &ndash;AutoSize</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Custom formatting for listing management servers so you can see which systems are holding which roles</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Get the action account that should be used<br /> $CorrectRunAs = Get-SCOMRunAsAccount -Name &lsquo;YourAccountNameHere&rsquo; | where-object {$_.AccountType -eq 'SCOMActionAccountSecureData'}<br /> <br /> # Get the management server(s) that are not using that account<br /> Get-SCOMManagementServer | where-object{$_.ActionAccountIdentity -ne $CorrectRunAs.Name}</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Identify any management or gateway server that is not running the correct default action account</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># Show the list of management servers, their health state and how many agents they manage<br /> get-scommanagementserver | ft -Property Name, HealthState, @{Name='Agent Count'; Expression={$_.GetAgentManagedComputers().Count}} &ndash;AutoSize<br /> <br /> # Get the list of agents reporting to a server<br /> $Agents = (get-SCOMManagementServer -Name &lsquo;YourServerName&rsquo;).GetAgentManagedComputers()<br /> <br /> # Show just the agents from that server that are not healthy<br /> # Note: Use the HostedHealthService property to look at the real agent state.<br /> $Agents.HostedHealthService | where-object{$_.HealthState -ne 'Success'}<br /> <br /> # Given an agent, find the parent management or gateway server(s)<br /> Get-SCOMAgent &ndash;Name &ldquo;YourAgentName&rdquo; | Get-SCOMParentManagementServer</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Various commands to make the connection between servers and agents and vice versa</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">$UnhealthyServers = get-SCOMManagementServer | where-object{$_.HealthState -ne 'Success'}</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get a list of all management and gateway servers that are unhealthy</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;">$UnhealthyServers | foreach-object{$_.HostedHealthService}</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Get the related health service objects for the unhealthy management and gateway servers</span></span></p>
</td>
</tr>
<tr>
<td valign="top" width="407">
<p><span style="font-family: courier new,courier; font-size: small;"># load the functions up into your session<br /> . FullPathToFile\Write-SCOMMonitoringStateHierarchy.ps1<br /> <br /> # Get the hosted health services, from those get the hierarchies <br /> #&nbsp; and with those do the output to the screen<br /> $UnhealthyServers | foreach-object{$_.HostedHealthService} | foreach-object{$_.GetMonitoringStateHierarchy()} | Write-SCOMMonitoringStateHierarchy</span></p>
</td>
<td valign="top" width="216">
<p><span style="font-size: small;"><span style="font-family: Calibri;">Show a hierarchical view of state, similar to health explorer, of the unhealthy management and gateway servers, using a custom function.<br /> <br /> The file <strong>Write-SCOMMonitoringStateHierarchy.ps1</strong> is attached to the original blog post.</span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>I want YOU to vote... On my Azure suggestions for System Center</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/i-want-you-to-vote-on-my-azure-suggestions-for-system-center</link>
      <pubDate>Wed, 12 Sep 2012 16:00:52 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2012/09/12/i-want-you-to-vote-on-my-azure-suggestions-for-system-center/</guid>
      <description><![CDATA[So, in a continuation of the Azure Monitoring stuff I've been working on lately, I see and heard...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/87/25/1452.i-want-you-to-vote-2.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-87-25/1452.i_2D00_want_2D00_you_2D00_to_2D00_vote_2D00_2.jpg"><img width="183" height="209" alt="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/87/25/1452.i-want-you-to-vote-2.jpg" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-87-25/1452.i_2D00_want_2D00_you_2D00_to_2D00_vote_2D00_2.jpg" border="0" /></a></p>
<p>So, in a continuation of the Azure Monitoring stuff I've been working on lately, I see and heard of a lot of places where System Center could be doing a lot of cool stuff to make life better for our application teams that are moving to Azure.&nbsp; As a result I've submitted a bunch of suggestions to the <a title="connect site" href="https://connect.microsoft.com" target="_blank">connect site</a>.&nbsp; What would be very helpful for me and for the System Center team is if they got more input from all of you in the form of votes on the suggestions that I've submitted.</p>
<p>So, below is the list of the suggestions I've posted specifically around Azure related features Microsoft IT would like to see.&nbsp; If you look these over and you agree they would be useful for you, please give them an up vote.&nbsp; If you don't think they're useful, you can down vote too.&nbsp; If for some reason you can't vote on the connect site, feel free to leave a comment on this post and I can forward that input along.</p>
<p>Thanks in advance!</p>
<ul>
<li>Add a way to encrypt storage account connection strings: <a href="https://connect.microsoft.com/SC/feedback/details/758265/opsmgr-azure-add-a-supported-way-to-read-an-encrypted-storage-account-connection-string">https://connect.microsoft.com/SC/feedback/details/758265/opsmgr-azure-add-a-supported-way-to-read-an-encrypted-storage-account-connection-string</a></li>
<li>Provide monitoring for service bug: <a href="https://connect.microsoft.com/SC/feedback/details/758266/opsmgr-azure-provide-monitoring-for-service-bus">https://connect.microsoft.com/SC/feedback/details/758266/opsmgr-azure-provide-monitoring-for-service-bus</a></li>
<li>Provide reporting and dashboards for consumption and utilization: <a href="https://connect.microsoft.com/SC/feedback/details/758268/opsmgr-azure-provide-reporting-and-dashboards-for-measuring-consumption-and-utilization">https://connect.microsoft.com/SC/feedback/details/758268/opsmgr-azure-provide-reporting-and-dashboards-for-measuring-consumption-and-utilization</a></li>
<li>Provide wizards for adding monitoring to azure applications: <a href="https://connect.microsoft.com/SC/feedback/details/758269/opsmgr-azure-provide-wizards-for-adding-monitoring-to-azure-applications">https://connect.microsoft.com/SC/feedback/details/758269/opsmgr-azure-provide-wizards-for-adding-monitoring-to-azure-applications</a></li>
<li>Provide the means to scale role instances up and down based on performance data: <a href="https://connect.microsoft.com/SC/feedback/details/758271/opsmgr-azure-provide-the-means-to-detect-the-need-for-scaling-up-or-down-role-instances">https://connect.microsoft.com/SC/feedback/details/758271/opsmgr-azure-provide-the-means-to-detect-the-need-for-scaling-up-or-down-role-instances</a></li>
<li>Detect when Azure storage blobs and tables haven't been backed up and give me a simple way to do that backup: &nbsp;<a href="https://connect.microsoft.com/SC/feedback/details/762418/provide-either-a-dpm-or-opsmgr-mp-based-soluiton-to-take-azure-blob-table-backups-snapshots-and-restores">https://connect.microsoft.com/SC/feedback/details/762418/provide-either-a-dpm-or-opsmgr-mp-based-soluiton-to-take-azure-blob-table-backups-snapshots-and-restores</a></li>
<li>Detect when my management certs are going to expire and help me easily keep them up to date: <a href="https://connect.microsoft.com/SC/feedback/details/762422/provide-a-means-to-detect-when-azure-management-certificates-will-expire-and-a-means-to-refresh-them">https://connect.microsoft.com/SC/feedback/details/762422/provide-a-means-to-detect-when-azure-management-certificates-will-expire-and-a-means-to-refresh-them</a></li>
<li>Provide monitoring for shared caching quotas: <a href="https://connect.microsoft.com/SC/feedback/details/762424/provide-monitoring-for-shared-caching-quotas">https://connect.microsoft.com/SC/feedback/details/762424/provide-monitoring-for-shared-caching-quotas</a></li>
<li>Provide discovery and monitoring of Azure storage accounts: <a href="https://connect.microsoft.com/SC/feedback/details/762426/provide-discovery-and-monitoring-of-windows-azure-storage-accounts">https://connect.microsoft.com/SC/feedback/details/762426/provide-discovery-and-monitoring-of-windows-azure-storage-accounts</a></li>
<li>Provide discovery and monitoring of SQL Azure data syncs: <a href="https://connect.microsoft.com/SC/feedback/details/762427/provide-discovery-of-and-montioring-for-sql-azure-data-sync">https://connect.microsoft.com/SC/feedback/details/762427/provide-discovery-of-and-montioring-for-sql-azure-data-sync</a></li>
</ul>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Monitoring Azure applications - Part 4</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/monitoring-azure-applications-part-4</link>
      <pubDate>Thu, 16 Aug 2012 14:24:00 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2012/08/16/monitoring-azure-applications-part-4/</guid>
      <description><![CDATA[The &ldquo;Monitoring Azure applications&rdquo; series:

Part 1: Enabling instrumentation and...]]></description>
      <content:encoded><![CDATA[<p>The &ldquo;Monitoring Azure applications&rdquo; series:</p>
<ul>
<li><a href="https://blogs.technet.com/b/corydelamarter/archive/2011/08/19/monitoring-azure-applications-part-1.aspx">Part 1: Enabling instrumentation and monitoring in your Azure app(s)</a></li>
<li><a href="https://blogs.technet.com/b/corydelamarter/archive/2012/02/02/monitoring-azure-applications-part-2.aspx">Part 2: Setting up the handshake</a></li>
<li><a href="https://blogs.technet.com/b/corydelamarter/archive/2012/03/29/monitoring-azure-applications-part-3.aspx">Part 3: Discovering your application</a></li>
<li><a href="https://blogs.technet.com/b/corydelamarter/archive/2012/08/16/monitoring-azure-applications-part-4.aspx">Part 4: When things don&rsquo;t work</a></li>
</ul>
<p>Up until now we&rsquo;ve worked through getting your Azure application setup for monitoring and we&rsquo;ve gone through the process of getting it discovered.&nbsp; But, just like anything else in IT (and life&hellip;), something always seems to go wrong the first time.&nbsp; Also, maybe you&rsquo;ve setup your Azure application monitoring, but then suddenly, one day you get a call from the team that runs the Azure application and they say, &ldquo;Hey!&nbsp; Our Azure app is down and your (insert negative adjective here) monitoring didn&rsquo;t catch it&rdquo;.&nbsp; This post talks about the ways that I&rsquo;ve seen the Azure MP fail (I&rsquo;m sure there are some I&rsquo;ve not hit yet) and talks about how I&rsquo;ve detected the problem and what I had to do to fix it.</p>
<p>Upfront, I also want to point out that since Azure workflows run on management servers and on watcher nodes the events mentioned in this post manifest in the OperationsManager event log one or both of the following places:</p>
<ul>
<li>Any watcher node that is trying to access an Azure application with the certificate</li>
<li>The root management server in OpsMgr 2007 R2, or one of the management servers in the management server pool in OpsMgr 2012</li>
</ul>
<p><strong>Your Run As Account(s) are not setup right</strong></p>
<p>In the <a href="https://blogs.technet.com/b/corydelamarter/archive/2012/02/02/monitoring-azure-applications-part-2.aspx">2<sup>nd </sup>post of this series</a>, we talked about setting up the handshake.&nbsp; In that we had to setup 2 run as accounts (one to store the certificate and one to store the password used to access the certificate).&nbsp; I&rsquo;ve seen this fail in one of two ways.</p>
<p><span style="text-decoration: underline;">Way#1: The password used to access the certificate is incorrect</span>:&nbsp; Unlike windows accounts, where the UI will verify the password you enter against AD, the basic authentication account will gladly take any string you give it.&nbsp; Its only when OpsMgr tries to use that password on the certificate, that it realizes that something is wrong.&nbsp;</p>
<p>The way it manifests is in an event in the OperationsManager event log&hellip;</p>
<p style="padding-left: 30px;"><strong>Source: </strong>Health Service Modules<br /><strong>Event ID: </strong>34000<br /><strong>Description: </strong>Failed to load the<br />certificate for the Windows Azure Service Management API. Please verify that a<br />valid certificate and password are assigned to the Run As accounts used for<br />Windows Azure monitoring.<br />&hellip;<br />Instance name: &lt;InstanceName&gt;<br />&hellip;<strong></strong></p>
<p>And an alert&hellip;</p>
<p style="padding-left: 30px;"><strong>Alert Rule:</strong> Windows Azure Invalid Certificate<br /><strong>Alert Description</strong>: Failed to load<br />the certificate for the Windows Azure Service Management API. Please verify<br />that a valid certificate and password are assigned to the Run As accounts used<br />for Windows Azure monitoring.<br />&hellip;<br />Instance name: &lt;InstanceName&gt;<br />&hellip;</p>
<p>I included the &ldquo;Instance name: &lt;InstanceName&gt;&rdquo; part above, because this is how you figure out which credentials you need to work on.&nbsp; If you&rsquo;ve only got one cert or you&rsquo;ve only got one app, then you don&rsquo;t have to dig too much, but for those that have multiple accounts to manage, there is some digging you have to do here, and a best practice I suggest:</p>
<ol>
<li>Get the value from &lt;InstanceName&gt;</li>
<li>Move to the Monitoring section of the console</li>
<li>Navigate to <strong>Monitoring </strong>-&gt; <strong>Windows Azure</strong> -&gt; <strong>Role Instance State</strong></li>
<li>Find the object that has the same name as the &lt;InstanceName&gt; and in the Detail View, note the <strong>Full Path Name</strong></li>
<li>The format of Full Path Name for an instance is &lt;Hosted Service&gt;\&lt;Deployment&gt;\&lt;Role&gt;\&lt;Instance&gt;, so from this you can take the value from the beginning of the path</li>
<li>Now switch to the <strong>Authoring</strong> section of the console and navigate to <strong>Authoring</strong> -&gt; <strong>Management Pack Templates</strong> -&gt; <strong>Windows Azure Application</strong></li>
<li>Unfortunately, this is where you have to hunt and peck, because the UI does not provide any clear connections between the name of the objects and the name of the Windows Azure Applications.&nbsp;<ol>
<li><span style="text-decoration: underline;">Unless</span>, you follow a <strong><span style="text-decoration: underline;">best practice</span></strong> I suggest.&nbsp; That best practice is to always put the <strong>DNS prefix of the hosted service</strong> into the Name of the Windows Azure Application template that you create.&nbsp; This way, you can use the &ldquo;Hosted Service&rdquo; from the full path name above, to quickly make the connection.</li>
<li>Once you find the right Windows Azure Application, open its properties and capture the name of the run as account used under <strong>Azure Certificate Password Run As Account</strong></li>
<li>Now switch to the <strong>Administration </strong>section and navigate to <strong>Administration</strong> -&gt; <strong>Run As Configuration</strong> -&gt; <strong>Accounts</strong></li>
<li>Locate the run as account that you captured in step 8, above, update its password to the correct value and save the changes.</li>
</ol></li>
</ol>
<p>You know your updates worked by looking in the event log where you first saw the 34000 events.&nbsp; If you see an event that looks like the following and the value for &lt;HostedServiceName&gt; matches what you saw in step 5 above, then you&rsquo;re back up and running:</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Health Service Modules<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34011<br /><strong>Description</strong>: A client for Windows Azure Storage Service has been initialized.<br /><strong><br /></strong>Subscription ID: &lt;SubscriptionIDGuid&gt;<br />Service name: &lt;HostedServiceName&gt;<br />&hellip;</p>
<p><span style="text-decoration: underline;">Way#2: The account(s) are not correctly configured for distribution</span>: In the 2007 R2 timeframe this new feature was added to Run As Accounts for &ldquo;More Secure&rdquo; or &ldquo;Less Secure&rdquo; distribution.&nbsp; If you followed the steps in the 2<sup>nd </sup>post of this series, then you set things up as &ldquo;More Secure&rdquo; and what that means is that you have to explicitly pick which systems the account is authorized to be distributed to.&nbsp; Unfortunately, if you ever add new management servers or start using a new watcher, then those systems may not be authorized for distribution. This manifests as an event&hellip;</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HealthService<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1108<br /><strong>Description</strong>: An Account specified in the Run As Profile "Microsoft.SystemCenter.Azure.RunAsProfile.Password" cannot be resolved. Specifically, the account is used in the Secure Reference Override&nbsp;&nbsp; "&lt;SomeLongStringHere&gt;".&nbsp; This condition may have occurred because the Account is not configured to be distributed to this computer. To resolve this problem, you need to open the Run As Profile specified below, locate the Account entry as specified by its SSID, and either choose to distribute the Account to this computer if appropriate, or change the setting in the Profile so that the target object does not use the specified Account. <br /><br />Management Group:&nbsp; &lt;ManagementGroupName&gt;<br />Run As Profile:&nbsp; Microsoft.SystemCenter.Azure.RunAsProfile.Password&nbsp; <br />&hellip;<br />Object name:&nbsp; &lt;HostedServiceName&gt;</p>
<p>But no alert!?</p>
<p>So, if you followed the best practice I mentioned above and put the <strong>DNS prefix of the hosted service </strong>into the <strong>Name</strong> of the <strong>Windows Azure Application</strong> template that you created, then you can do the following:</p>
<ol>
<li>Find the right Windows Azure Application, open its properties and capture the names of both run as accounts used (<strong>Azure Certificate Password Run As Account </strong>and <strong>Azure Certificate Run As Account</strong>)</li>
<li>Now switch to the <strong>Administration </strong>section and navigate to <strong>Administration</strong> -&gt; <strong>Run As Configuration</strong> -&gt; <strong>Accounts</strong></li>
<li>Locate the run as accounts that you captured in step 1, above.</li>
<li>For both accounts do the following:</li>
<ol>
<li>Open the properties of the run as account and switch to the <strong>Distribution</strong> tab</li>
<li>Confirm <strong>More secure</strong> is selected and click the <strong>Add </strong>button</li>
<li>Add all management servers and all systems that you use as watcher nodes</li>
<li>Click OK to apply the changes</li>
</ol></ol>
<p>Just like the previous case, you know your updates worked by looking in the event log where you first saw the 1108 events.&nbsp; If you see an event that looks like the following and the value for &lt;HostedServiceName&gt; matches what you saw in the 1108 event, then things are back in order:</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Health Service Modules<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34011<br /><strong>Description</strong>: A client for Windows Azure Storage Service has been initialized.<br /><strong><br /></strong>Subscription ID: &lt;SubscriptionIDGuid&gt;<br />Service name: &lt;HostedServiceName&gt;<br />&hellip;</p>
<p><strong>Your watcher node errors out when trying to access the Azure Service Management API</strong></p>
<p>The next group of problems comes when the watcher node (aka proxy agent) tried to reach out and talk to Windows Azure.&nbsp; For me, I&rsquo;ve also seen two distinct types of mishaps here.</p>
<p><span style="text-decoration: underline;">Way#1: Typos in the <strong>Windows Azure Application</strong> template</span>: I don&rsquo;t know about you, but I constantly mistype things.&nbsp; Half of the reason I take so much time to do blog posts is because I&rsquo;m fixing typos J.&nbsp; So, its no surprise that I&rsquo;ve accidentally mistyped some details into the <strong>Windows Azure Application</strong> template.&nbsp; When I do this, it messes up the Azure MP because the Azure MP needs that information to query the Azure Service Management API.</p>
<p>This shows up as an event in the event log&hellip;</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;Health Service Modules<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34004<br /><strong>Description</strong>: REST operation against Windows Azure Service has failed because the specified resource in the URI does not exist. <br /><br />Request method: GET<br />Request URI: https://management.core.windows.net/<strong><a>&lt;SubscriptionIDGuid</a> you entered&gt;</strong>/services/hostedservices/<strong>&lt;DNSPrefix you entered&gt;</strong>?embed-detail=true <br />Response status code: NotFound <br />Response status description: Not Found <br />Error code: ResourceNotFound <br />Error message: The hosted service does not exist. <br />Error XML: &lt;Error xmlns=https://schemas.microsoft.com/windowsazure xmlns:i="https://www.w3.org/2001/XMLSchema-instance"&gt;&lt;Code&gt;ResourceNotFound&lt;/Code&gt;&lt;Message&gt;The hosted service does not exist.&lt;/Message&gt;&lt;/Error&gt;<br />Exception: The remote server returned an error: (404) Not Found.</p>
<p>But again, no alert!?&nbsp; In order to track down the typo, you do the following:</p>
<ol>
<li>Capture the <strong>&lt;DNSPrefix you entered&gt;</strong> from the event</li>
<li>Using that string, try full and partial searches of your Windows Azure Application list until you find the right one.</li>
<ol>
<li>Again, this assumes that you&rsquo;re following the best practice I mentioned above of putting the <strong>DNS prefix of the hosted service</strong> into the <strong>Name</strong> of the <strong>Windows Azure Application</strong> template.</li>
</ol>
<li>Open its properties and reconcile the <strong>DNS prefix of the hosted service</strong> and the <strong>Subscription ID </strong>values, with what is in the Azure Portal.</li>
<li>Fix any typos and click <strong>OK</strong> to apply the changes</li>
</ol>
<p>The same type of 34011 event that is mentioned above, is the clear indicator that you&rsquo;ve fixed the typo.&nbsp; Likewise, you can keep refreshing the <strong>Hosted Service State</strong> view in the monitoring section of the console, until you see the new hosted service show up there.</p>
<p><span style="text-decoration: underline;">Way#2: I need to use a proxy server or I typo&rsquo;d the proxy server</span>: OK, to be honest I&rsquo;ve not encountered this one, but I know it can happen.&nbsp; What I&rsquo;m showing you below is actually from a management group where I just turned off the network connection to simulate a lack of connectivity.&nbsp; The symptoms should look very similar though.&nbsp; You would see the following events&hellip;</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Health Service Modules<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34016<br /><strong>Description</strong>:&nbsp; The remote name could not be resolved: 'management.core.windows.net'. Please check the connection to the remote server or the proxy setting in the workflow configuration. <br /><br />Subscription ID: &lt;SubscriptionIDGuid&gt;<br />Service name: &lt;HostedServiceName&gt;<br />&hellip;</p>
<p>or</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Health Service Modules<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34016<br /><strong>Description</strong>: The remote name could not be resolved: '<strong>&lt;DNSPrefix you entered&gt;</strong>.table.core.windows.net'. Please check the connection to the remote server or the proxy setting in the workflow configuration. <br /><br />Subscription ID: &lt;SubscriptionIDGuid&gt; <br />Service name: <strong>&lt;DNSPrefix you entered&gt;<br /></strong>Proxy address:&nbsp; <br />Exception: The remote name could not be resolved: '<strong>&lt;DNSPrefix you entered&gt;</strong>.table.core.windows.net'</p>
<p>And you will see an alert&hellip;</p>
<p style="padding-left: 30px;"><strong>Alert Rule</strong>: Windows Azure Remote Name Resolution Failure<br /><strong>Alert Description</strong>: The remote name could not be resolved: &lt;SomeURL&gt;. Please check the connection to the remote server or the proxy setting in the workflow configuration.<br /><br />Subscription ID: &lt;SubscriptionIDGuid&gt;<br />Service name: <strong>&lt;DNSPrefix you entered&gt;</strong><br />Proxy address: <br />Exception: The remote name could not be resolved: &lt;SomeURL&gt;<br />&hellip;</p>
<p>In order to track down the typo, you do the following:</p>
<ol>
<li>Capture the <strong>&lt;DNSPrefix you entered&gt;</strong> from the event</li>
<li>Using that string, try full and partial searches of your Windows Azure Application list until you find the right one</li>
<ol>
<li>Again, this assumes that you&rsquo;re following the best practice I mentioned above of putting the <strong>DNS prefix of the hosted service</strong> into the <strong>Name</strong> of the <strong>Windows Azure Application</strong> template</li>
</ol>
<li>Open its properties and reconcile the<strong> </strong>information entered for the proxy server</li>
<li>Fix any typos and click <strong>OK</strong> to apply the changes</li>
</ol>
<p><span style="text-decoration: underline;">Way#3: Your certificate is not a management certificate on the Azure subscription</span>: Lastly, it is possible that the certificate that is being used in the run as account for Azure monitoring, is not yet added as a management certificate on the hosted service.</p>
<p>If that happens you&rsquo;ll see the following event&hellip;</p>
<p style="padding-left: 30px;"><strong>Source</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Health ServiceModules<br /><strong>Event ID</strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34015<br /><strong>Description</strong>: Failed to authenticate the request. Please verify that the certificate for the Windows Azure Service Management API is valid and is associated with the subscription. <br /><br />Subscription ID: &lt;SubscriptionIDGuid&gt;<br />Service name: &lt;HostedServiceName&gt;<br /><br />Request method: GET <br />Request URI: https://management.core.windows.net/&lt;SubscriptionIDGuid&gt;/services/hostedservices/&lt;HostedServiceName&gt;?embed-detail=true<br />Error code: AuthenticationFailed <br />Error message: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription. <br />Error XML: &lt;Error xmlns=https://schemas.microsoft.com/windowsazure xmlns:i="https://www.w3.org/2001/XMLSchema-instance"&gt;&lt;Code&gt;AuthenticationFailed&lt;/Code&gt;&lt;Message&gt;The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.&lt;/Message&gt;&lt;/Error&gt; <br /><br />Inner exception: The remote server returned an error: (403) Forbidden. <br />&hellip;</p>
<p>And you will see an alert&hellip;</p>
<p style="padding-left: 30px;"><strong>Alert Rule</strong>: Windows Azure Management Client Authentication Failure<br /><strong>Alert Description</strong>: Failed to authenticate the request. Please verify that the certificate for the Windows Azure Service Management API is valid and is associated with the subscription.<br />Request method: GET <br />Request URI: https://management.core.windows.net/&lt;SubscriptionIDGuid&gt;/services/hostedservices/&lt;HostedServiceName&gt;?embed-detail=true<br />Error code: AuthenticationFailed <br />Error message: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription. <br />Error XML: &lt;Error xmlns=https://schemas.microsoft.com/windowsazure xmlns:i="https://www.w3.org/2001/XMLSchema-instance"&gt;&lt;Code&gt;AuthenticationFailed&lt;/Code&gt;&lt;Message&gt;The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.&lt;/Message&gt;&lt;/Error&gt; <br /><br />Inner exception: The remote server returned an error: (403) Forbidden.<br />&hellip;</p>
<p>In order to fix this issue you&rsquo;ll need to add the certificate as a management certificate, by following the instructions covered in the <a href="https://blogs.technet.com/b/corydelamarter/archive/2012/02/02/monitoring-azure-applications-part-2.aspx">Monitoring Azure applications &ndash; Part 2</a> post under <strong>Add the private key (.CER) to your Azure subscriptions as a &ldquo;Management Certificate&rdquo;</strong>.</p>
<p><strong>Your watcher node is unable to access the Windows Azure storage account</strong></p>
<p>The last area that I&rsquo;ve encountered failures is around how the Azure watchers try to access the Windows Azure storage accounts for each host service.&nbsp; The storage account is where all of the instrumentation is stored for a hosted service, so getting to the account is very important.&nbsp;</p>
<p>For better or worse, the storage account connection details is not something that you can configure statically within OpsMgr.&nbsp; Instead the way the Azure MP works is that it uses the service management API to connect to the Hosted Service and then programmatically looks up the connection details to the storage account.&nbsp; Some of this behavior is also described in the Azure MP guide within the prerequisites section, <a href="https://technet.microsoft.com/en-us/library/gg276375">here</a>.</p>
<p>Following are the two ways in which I&rsquo;ve seen this part of the process fail:</p>
<ul>
<li>Way#1: The name of the setting in the config file is something other than &ldquo;<strong>DiagnosticsConnectionString&rdquo;</strong><strong></strong></li>
<li>Way#2: The setting in the config file does not exist or has an invalid value</li>
</ul>
<p>The resolution steps for both cases is already covered in great detail on Walter Myers&rsquo; blog, <a href="https://blogs.msdn.com/b/walterm/archive/2012/01/16/resolving-windows-azure-diagnostics-connection-string-issues-with-scom-2007-r2.aspx">here</a>.</p>
<p>So that&rsquo;s it!&nbsp; Those are all of the ways that I know of that the workflows can fail.&nbsp; Hopefully this is a useful resource for someone out there on the interwebs.</p>
<p>Cheers!</p>]]></content:encoded>
    </item>
    <item>
      <title>TechNet Radio: IT Time - Using System Center 2012 Operations Manager to Manage Your [Hybrid] Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/corydelamarter/technet-radio-it-time-using-system-center-2012-operations-manager-to-manage-your-hybrid-applications</link>
      <pubDate>Tue, 05 Jun 2012 08:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Cory Delamarter]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/corydelamarter/2012/06/05/technet-radio-it-time-using-system-center-2012-operations-manager-to-manage-your-hybrid-applications/</guid>
      <description><![CDATA[I guess I did something right last time because the guys at TechNet Radio invited me back for...]]></description>
      <content:encoded><![CDATA[<p>I guess I did something right last time because the guys at TechNet Radio invited me back for another recording.&nbsp; While I'm not too fond of the video quality from my webcam, I am fond of the demo we did of how IT uses Operations Manager to fold together on-premises and Azure based components into one view.</p>
<p>Check it out <a title="TechNet Radio: IT Time - Inside Microsoft IT - Using System Center 2012 Operations Manager to Manage your Applications" href="https://bit.ly/HV80ZH">here</a>!</p>
<p>&nbsp;</p>
<script src="https://technet.microsoft.com/en-us/videoembed/technet-radio-it-time-inside-microsoft-it-using-system-center-2012-operations-manager-to-manage-your-applications" type="text/javascript"></script>]]></content:encoded>
    </item>
  </channel>
</rss>