<?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>System Center Operations Manager Command Shell</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/scshell/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/scshell/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 04:07:01 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>What Rules My Class?</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/what-rules-my-class</link>
      <pubDate>Thu, 13 Dec 2007 14:48:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/12/13/what-rules-my-class/</guid>
      <description><![CDATA[There have been a few questions regarding how to enumerate the rules targeting a class.
Here is a...]]></description>
      <content:encoded><![CDATA[<P>There have been a few questions regarding how to enumerate the rules targeting a class.</P>
<P>Here is a script you can save as a file. I named the script get-rulesforclass.ps1</P>
<BLOCKQUOTE class=code>
<P>param ([String] $className)</P>
<P>$class = get-monitoringclass | where {$_.Name -eq $className}</P>
<P>if ($class -eq $null)<BR>{<BR>&nbsp;throw "Class '$className' not found.";<BR>}</P>
<P>if ($class -is [Array])<BR>{<BR>&nbsp;throw "More than one class was found with name '$className'.";<BR>}</P>
<P>write-host $class</P>
<P>get-rule | where {$_.Target.Id -eq $class.Id} </P></BLOCKQUOTE>
<P>Pass the name of the class to the script.</P>
<BLOCKQUOTE class=code>
<P>get-rulesforclass.ps1 Microsoft.Windows.Computer</P></BLOCKQUOTE>
<P>The Target property of the rule is where most people get stuck because it is not clear that you must refer to the Id property off of the target property to perform the comparison against the class's Id.</P>
<P mce_keep="true">This is the final blog post to the System Center Operations Manager Command Shell blog. I will be changing my focus and no longer have time to properly contribute to this blog. As this is the last post I will not longer be taking questions or comments. I wish you all the best of luck in your scripting endeavors.</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face=Calibri>Sayonara!</FONT></FONT>&nbsp;</P>
<P mce_keep="true">Roger Sprague</P>]]></content:encoded>
    </item>
    <item>
      <title>Where Are My Properties?</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/where-are-my-properties</link>
      <pubDate>Mon, 26 Nov 2007 15:14:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/11/26/where-are-my-properties/</guid>
      <description><![CDATA[I consistently get asked how to display&nbsp;class specific properties. The solution is simple but...]]></description>
      <content:encoded><![CDATA[<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">I consistently get asked how to display&nbsp;class specific properties. The solution is simple but not very obvious. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<BLOCKQUOTE class=code>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">get-monitoringobject ...&nbsp;|&nbsp;format-list *&nbsp;<o:p></o:p></SPAN></P></BLOCKQUOTE>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">You are probably wondering why you even need to do this. <o:p></o:p></SPAN></P>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">You are not alone:)&nbsp;<o:p></o:p></SPAN></P>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Each MonitoringObject can be an instance of multiple classes so there is no limit on the number of enumerable properties on each MonitoringObject. To control the formatting experience we only display properties that are essential to identifying the instance you want to manage. To see the remaining properties you must override the default formatter by calling format-list or format-table. When attempting to format an object which has&nbsp;four or more&nbsp;variable length properties I find that format-list works best. Let's take a closer look at displaying all of the properties for each instance of Microsoft.Windows.Computer.<o:p></o:p></SPAN></P>
<BLOCKQUOTE class=code>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">$class = get-monitoringclass | where {$_.Name -eq "Microsoft.Windows.Computer"}<o:p></o:p></SPAN></P>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">get-monitoringobject -MonitoringClass: $class | format-list *<o:p></o:p></SPAN></P></BLOCKQUOTE>
<BLOCKQUOTE class=code>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P></BLOCKQUOTE><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">BTW this approach also works with objects returned by the&nbsp;OperationsManagerMonitoring provider.</SPAN> 
<BLOCKQUOTE class=code>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">PS Monitoring:\localhost</SPAN></P>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&gt;dir | format-list *<o:p></o:p></SPAN></P></BLOCKQUOTE>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">And in case you aren't already aware 'fl' is&nbsp;the alias for format-list so the following command will work as well.<o:p></o:p></SPAN></P>
<BLOCKQUOTE class=code>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">dir | fl *<o:p></o:p></SPAN></P></BLOCKQUOTE>
<P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp;<o:p></o:p></SPAN></P>
<P>Hope that helps and as always please post your questions and comments and I will make sure they are addressed in future posts. 
<P>Roger Sprague </P>]]></content:encoded>
    </item>
    <item>
      <title>Deleting Agents</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/deleting-agents</link>
      <pubDate>Wed, 25 Apr 2007 16:27:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/04/25/deleting-agents/</guid>
      <description><![CDATA[A few of you sent mail asking how to delete an agent using the Command Shell. There is a Cmdlet for...]]></description>
      <content:encoded><![CDATA[<P>A few of you sent mail asking how to delete an agent using the Command Shell. There is a Cmdlet for uninstalling an agent called Uninstall-Agent.&nbsp;However, uninstalling an agent will not work&nbsp;if&nbsp;the computer the&nbsp;agent is hosted by is not&nbsp;available.&nbsp;To help address the issue I&nbsp;created a function to automate the process. Keep in mind this function should only be used to delete an agent&nbsp;hosted by a&nbsp;computer that no longer exists otherwise you should use Uninstall-Agent.&nbsp;</P>
<BLOCKQUOTE class=code>
<P># Summary<BR>#&nbsp;&nbsp;&nbsp;&nbsp; Delete an agent hosted by a non-existent computer.<BR># Params<BR>#&nbsp;&nbsp;&nbsp;&nbsp; AgentNames - An array of strings that contain the FQDN of agents to delete.<BR># Returns<BR>#&nbsp;&nbsp;&nbsp;&nbsp; None<BR>function global:Delete-Agent([System.String[]] $agentNames)<BR>{<BR>&nbsp;$NoAgentsErrorMsg = "`nNo agent names specified. Please specify the FQDN for each agent you want to delete.`n";</P>
<P><BR>&nbsp;if ($agentNames -eq $null)<BR>&nbsp;{<BR>&nbsp;&nbsp;Write-Host $NoAgentsErrorMsg;<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</P>
<P>&nbsp;$administration = (get-item .).ManagementGroup.GetAdministration();</P>
<P>&nbsp;$agentManagedComputerType = [Microsoft.EnterpriseManagement.Administration.AgentManagedComputer];</P>
<P>&nbsp;$genericListType = [System.Collections.Generic.List``1]<BR>&nbsp;$genericList = $genericListType.MakeGenericType($agentManagedComputerType)</P>
<P>&nbsp;$agentList = new-object $genericList.FullName</P>
<P>&nbsp;foreach ($agentName in $agentNames)<BR>&nbsp;{<BR>&nbsp;&nbsp;$agent = Get-Agent | where {$_.PrincipalName -eq $agentName}<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;if ($agent -eq $null)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;$msg =&nbsp; "Agent '{0}' not found." -f $agentName;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;Write-Host $msg;</P>
<P>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;$agentList.Add($agent);<BR>&nbsp;&nbsp;}&nbsp;<BR>&nbsp;}</P>
<P>&nbsp;if ($agentList.Count -eq 0)<BR>&nbsp;{<BR>&nbsp;&nbsp;Write-Host $NoAgentsErrorMsg;<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</P>
<P>&nbsp;$genericReadOnlyCollectionType = [System.Collections.ObjectModel.ReadOnlyCollection``1]<BR>&nbsp;$genericReadOnlyCollection = $genericReadOnlyCollectionType.MakeGenericType($agentManagedComputerType)</P>
<P>&nbsp;$agentReadOnlyCollection = new-object $genericReadOnlyCollection.FullName @(,$agentList);</P>
<P><BR>&nbsp;$msg = "`nDeleting {0} agents:`n" -f $agentReadOnlyCollection.Count;<BR>&nbsp;Write-Host $msg;<BR>&nbsp;foreach ($agent in $agentReadOnlyCollection)<BR>&nbsp;{<BR>&nbsp;&nbsp;Write-Host $agent.PrincipalName;<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;$administration.DeleteAgentManagedComputers($agentReadOnlyCollection);<BR>}<BR>&nbsp;</P></BLOCKQUOTE>
<P>Hope that helps and as always please post your questions and comments and I will make sure they are addressed in future posts. 
<P>Roger Sprague </P>]]></content:encoded>
    </item>
    <item>
      <title>Command Shell Introduction Video</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/command-shell-introduction-video</link>
      <pubDate>Tue, 17 Apr 2007 23:23:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/04/17/command-shell-introduction-video/</guid>
      <description><![CDATA[Right before MMS 2007 I finished a video to help introduce folks to the Command...]]></description>
      <content:encoded><![CDATA[<P><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Right before MMS 2007 I finished a video to help introduce folks to the Command Shell.</SPAN></SPAN></P>
<P><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Here's&nbsp;a link.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN></P>
<P><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><U><FONT color=#0066cc><A href="https://www.microsoft.com/winme/0703/28666/Command_Shell_Intro_Edited.asx" mce_href="https://www.microsoft.com/winme/0703/28666/Command_Shell_Intro_Edited.asx">https://www.microsoft.com/winme/0703/28666/Command_Shell_Intro_Edited.asx</A></FONT></U><A href="https://www.microsoft.com/winme/0703/28666/Command_Shell_Intro_Edited.asx" mce_href="https://www.microsoft.com/winme/0703/28666/Command_Shell_Intro_Edited.asx"><FONT color=#0000ff></FONT></A></SPAN></SPAN></SPAN></SPAN></P>
<P><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Let me know if you want more videos.&nbsp;</SPAN></SPAN></P>
<P><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">As always post your questions and comments.</SPAN></SPAN></P>
<P><SPAN class=label1><SPAN style="FONT-SIZE: 8.5pt; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Roger Sprague</SPAN></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Discovering Windows Computers</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/discovering-windows-computers</link>
      <pubDate>Fri, 09 Feb 2007 16:42:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/02/09/discovering-windows-computers/</guid>
      <description><![CDATA[&nbsp;
Much like the Operations Manager UI Console the Command Shell offers several ways to...]]></description>
      <content:encoded><![CDATA[<P mce_keep="true">&nbsp;</P>
<P>Much like the Operations Manager UI Console the Command Shell offers several ways to discover Windows computers. You can either search by computer name&nbsp;or search by LDAP query. Let start by looking at the diferences between each approach.</P>
<P mce_keep="true">&nbsp;</P>
<P>The following command defines a LDAP query and passes it to the New-WindowsDiscoveryConfiguration Cmdlet thereby creating an LDAP based WindowsDiscoveryConfiguration.</P>
<BLOCKQUOTE class=code>
<P>$query = New-LdapQueryDiscoveryCriteria –LdapQuery: “(sAMAccountType=805306369)(name=srv1.contoso.com*)” –Domain:”contoso.com” 
<P>$discoConfig = New-WindowsDiscoveryConfiguration –LdapQueryDiscoveryCriteria:$query</P></BLOCKQUOTE>
<P>In contrast the following command defines a name based WindowsDiscoveryConfiguration that will direct discovery to find both srv1.contoso.com and srv2.contoso.com. 
<BLOCKQUOTE class=code>
<P>$discoConfig = New-WindowsDiscoveryConfiguration&nbsp; -ComputerName: "srv1.contoso.com", "srv2.contoso.com" </P></BLOCKQUOTE>
<P>There is a lot more you can specify when defining a WindowsDiscoveryConfiguration. The following commands will direct the discovery module to use specific credentials, perform verification of each discovered Windows computer and constrain the type of discovered object to a Windows server. The ComputerType parameter is an enum that can be one of Workstation, Server, or Both. The PerformVerification switch is used to direct the discovery module to verify that only available computers should be returned. 
<BLOCKQUOTE class=code>
<P># Prompt for credentials used to perform the discovery. 
<P>$creds = Get-Credential 
<P># Define a WindowsDiscoveryConfiguration 
<P>$discoConfig = New-WindowsDiscoveryConfiguration –ComputerName:&nbsp;"srv3.contoso.com", "srv4.contoso.com"&nbsp;–PerformVerification: $true –ActionAccount:$creds -ComputerType: "Server" 
<P># Select the Management Server used to run the discovery. 
<P>$managementServer = Get-ManagementServer –Root: $true 
<P># Start the discovery process. 
<P>$discoResult = Start-Discovery –ManagementServer: $managementServer –WindowsDiscoveryConfiguration: $discoConfig 
<P># Check that the discovery process discovered the Windows computers you specified. 
<P>$discoResult.CustomMonitoringObjects 
<P># Last but not least install agents on the discovered computers. 
<P>Install-Agent –ManagementServer: $managementServer –AgentManagedComputer: $discoResult.CustomMonitoringObjects</P></BLOCKQUOTE>
<P>Hope that helps and as always please post your questions and comments and I will make sure they are addressed in future posts. 
<P>Roger Sprague </P>]]></content:encoded>
    </item>
    <item>
      <title>Running Tasks</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/running-tasks</link>
      <pubDate>Mon, 05 Feb 2007 22:30:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/02/05/running-tasks/</guid>
      <description><![CDATA[You can run a task from the Command Shell much like you would from the UI Console. You start by...]]></description>
      <content:encoded><![CDATA[<P>You can run a task from the Command Shell much like you would from the UI Console. You start by selecting the object you want to work with then you select the task you want to run. In this scenario we are going to look at resetting the Health Service store of a hypothetical&nbsp;agent named echo12.contoso.com.</P>
<P mce_keep="true">&nbsp;</P>
<P>Like most blog posts all of the examples&nbsp;are based on working directly from the Root Management Server with a connection defined to localhost. If that is not how you are working simply replace 'localhost' with the name of your connection in the examples.</P>
<BLOCKQUOTE class=code>
<P>Monitoring:\localhost</P>
<P>&gt;</P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P>
<P>Let's start by moving to the location of the Health Service of the computer we want to manage.&nbsp;If you are not sure just list all of the items under Microsoft.SystemCenter.AllComputersGroup by using 'dir' or the 'Get-ChildItem' command</P>
<BLOCKQUOTE class=code>
<P># Move to the AllComputersGroup.</P>
<P>cd Microsoft.SystemCenter.AllComputersGroup </P>
<P># List all&nbsp;of the member&nbsp;names of the AllComputersGroup</P>
<P>dir |&nbsp;Format-List PathName </P></BLOCKQUOTE>
<BLOCKQUOTE class=code>
<P># Move to the location of one of the members of the All Computers Group. </P>
<P>cd <STRONG>echo12.contoso.com</STRONG> </P>
<P># Move to the location of the Health Service running on your agent.</P>
<P>cd Microsoft.SystemCenter.HealthService</P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P>
<P>Your prompt should look similar to the following. Much like all of the other Monitoring Object centric Cmdlets both Get-Task and Start-Task use the path as a context from which to work.</P>
<BLOCKQUOTE class=code>
<P>Monitoring:\localhost\Microsoft.SystemCenter.AllComputersGroup\<STRONG>echo12.contoso.com</STRONG>\Microsoft.SystemCenter.HealthService</P>
<P>&gt;</P></BLOCKQUOTE>
<P>Now let's get all the tasks for the current Health Service instance.</P>
<BLOCKQUOTE class=code>
<P>Get-Task | Format-List Name</P></BLOCKQUOTE>
<P>We only care about resetting the Health Service store.&nbsp;We need to filter the results so that only the 'ResetHealthServiceStore' task is returned.</P>
<BLOCKQUOTE class=code>
<P>Get-Task | where {$_.Name -eq "Microsoft.SystemCenter.ResetHealthServiceStore"} </P></BLOCKQUOTE>
<P>Once you have verified that your filter is working you can start the task. </P>
<BLOCKQUOTE class=code>
<P>Get-Task | where {$_.Name -eq "Microsoft.SystemCenter.ResetHealthServiceStore"} | Start-Task</P></BLOCKQUOTE>
<P>Optionally you could create a variable to hold the task you want to start.</P>
<BLOCKQUOTE class=code>
<P>$task = Get-Task | where {$_.Name -eq "Microsoft.SystemCenter.ResetHealthServiceStore"}</P>
<P>Start-Task -Task: $task</P></BLOCKQUOTE>
<P>The Start-Task Cmdlet will&nbsp;block until the task it is complete. If that is not the desired behavior specify the Asynchronous switch. </P>
<BLOCKQUOTE class=code>
<P>Start-Task -Task: $task -Asynchronous</P></BLOCKQUOTE>
<P>If you want to see the status of your task a later time you can store the Task Result and use it to query for status updates.</P>
<BLOCKQUOTE class=code>
<P>$taskResult = Start-Task -Task: $task -Asynchronous</P>
<P>Get-TaskResult $taskResult.Id</P></BLOCKQUOTE>
<P>If the task requires credentials you must first enter your credentials and store them in a variable.</P>
<BLOCKQUOTE class=code>
<P>$creds = Get-Credential</P>
<P>Start-Task -Task: $task -Credential: $creds</P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P>
<P>Last but not least you can specify overrides for existing properties of a task. I recommend specifying overrides by defining a variable so that you can verify your work before submitting the task. The following example is fictitious and is only used to illustrate how you would define overrides for a task.</P>
<BLOCKQUOTE class=code>
<P>$overrides = @{SignatureID=10; AnotherID="1092834098123407953912837"}</P>
<P>Start-Task -Task: $task -Override: $overrides</P></BLOCKQUOTE>
<P>If you are not sure which overrides are available for a given task you can use the Get-Overrides Cmdlet. The following example lists the overrides for the task stored in the $task variable. </P>
<BLOCKQUOTE class=code>
<P>$task | Get-Override&nbsp;</P></BLOCKQUOTE>
<P>Hope that helps and as always please post your questions and comments and I will make sure they are addressed in future posts. 
<P>Roger Sprague</P>]]></content:encoded>
    </item>
    <item>
      <title>MCF Over Tiering</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/mcf-over-tiering</link>
      <pubDate>Wed, 10 Jan 2007 23:04:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/01/10/mcf-over-tiering/</guid>
      <description><![CDATA[If you are not familiar with MCF in MOM 2005 you can read more about it&nbsp;here.&nbsp;I do...]]></description>
      <content:encoded><![CDATA[<P><EM>If you are not familiar with MCF in MOM 2005 you can read more about it&nbsp;</EM><A href="https://blogs.msdn.com/jakuboleksy/archive/2006/11/21/differences-between-mcf-in-mom-2005-and-scom-2007.aspx" mce_href="https://blogs.msdn.com/jakuboleksy/archive/2006/11/21/differences-between-mcf-in-mom-2005-and-scom-2007.aspx"><EM>here</EM></A><EM>.&nbsp;I do not&nbsp;go into detail about MCF here as that is an area best covered by </EM><A href="https://blogs.msdn.com/jakuboleksy/" mce_href="https://blogs.msdn.com/jakuboleksy/"><EM>Jakub</EM></A><EM>. What I do want to show you is how to setup MCF over tiering using the Operations Manager Command Shell. I encourage you to look at how to </EM><A href="https://blogs.msdn.com/scshell/archive/2007/01/10/this-tier-is-your-tier.aspx" mce_href="https://blogs.msdn.com/scshell/archive/2007/01/10/this-tier-is-your-tier.aspx"><EM>setup tiering</EM></A><EM> before continuing on with this post.</EM></P>
<P mce_keep="true">&nbsp;</P>
<P>MCF over tiering is a bit different than normal tiering in that you must define a run-as account used&nbsp; by the Connector to connect to the tiered Management Group. Let's start by creating a run-as account used to connect to the Management Group you would like to tier. There is no Cmdlet&nbsp;for creating a run-as account so we must use PowerShell script to make Operations Manager SDK calls.</P>
<BLOCKQUOTE class=code>
<P mce_keep="true">&nbsp;</P>
<P>$runAsAccount = New-Object Microsoft.EnterpriseManagement.Monitoring.Security.MonitoringWindowsCredentialSecureData; 
<P># Use Get-Credential to get a password in the form of a SecureString type.<BR>$tierCreds = Get-Credential; 
<P># Assumes the user name is in format&nbsp;"domain\user".<BR>$domain,$userName, $junk = $tierCreds.UserName.Split("\"); <BR>$runAsAccount.Name = "My Tiered MCF Run-As Account"; # The name for this run-as account.<BR>$runAsAccount.UserName = $userName;<BR>$runAsAccount.Domain = $domain;<BR>$runAsAccount.SecureData = $tierCreds.Password; 
<P>$mg = (Get-Item .).ManagementGroup; # Get a reference to the SDK Management Group object. <BR>$mg.InsertMonitoringSecureData($runAsAccount); # Insert the run-as account.</P></BLOCKQUOTE>
<BLOCKQUOTE class=code></BLOCKQUOTE>
<P>That's that was a bit verbose. Just to make sure everything worked as expected run the following command and verify your new run-as account exists. 
<BLOCKQUOTE class=code>
<P>Get-RunAsAccount | fl Name</P></BLOCKQUOTE>
<P>Next we need to create a tier. 
<BLOCKQUOTE class=code>
<P># Get the credentials required to connect to the tiered Management Group.<BR>$creds = Get-Credential ;</P>
<P># Create the tier.<BR>$tier = New-Tier -Name: "MyMcfTier" -ManagementServerName: "server2" -Credential: $creds -RunAsAccount: $runAsAccount;</P></BLOCKQUOTE>
<P>Make sure your tier exists. 
<BLOCKQUOTE class=code>
<P>Get-Tier | fl Name</P></BLOCKQUOTE>
<P>Next we need to create the Connector. There is no Cmdlet&nbsp;for creating a Connector so we must use PowerShell script to make Operations Manager SDK calls. 
<BLOCKQUOTE class=code>
<P>$connectorInfo = New-Object Microsoft.EnterpriseManagement.ConnectorFramework.ConnectorInfo;<BR>$connectorInfo.Name = "McfOverTieringConnector";<BR>$connectorInfo.Description = "McfOverTieringConnector Description"<BR>$connectorInfo.DiscoveryDataIsManaged = $false;<BR>$connector = $mg.GetConnectorFrameworkAdministration().Setup($connectorInfo); </P></BLOCKQUOTE>
<P>Make sure your connector exists.</P>
<BLOCKQUOTE class=code>
<P>Get-Connector | fl Name</P></BLOCKQUOTE>
<P>Last but not least we need to add the connector to&nbsp;the tier. 
<BLOCKQUOTE class=code>
<P>Add-ConnectorToTier -Tier: $tier -Connector: $connector; </P></BLOCKQUOTE>
<P>Clearly the Command Shell could benefit from a New-RunAsAccount Cmdlet and a New-Connector Cmdlet to simplify this process. In the mean time I recommend you create functions that encapsulate any process that can't be completed using Cmdlets if you must complete the process multiple times.</P>]]></content:encoded>
    </item>
    <item>
      <title>This tier is your tier...</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/this-tier-is-your-tier</link>
      <pubDate>Tue, 09 Jan 2007 20:29:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/01/09/this-tier-is-your-tier/</guid>
      <description><![CDATA[If you happen to have multiple management groups and you need a way of seeing alerts...]]></description>
      <content:encoded><![CDATA[<P>If you happen to have multiple management groups and you need a way of seeing alerts aggregated&nbsp;across all of your Management Groups or you need a way of managing one Management Group via another (proxy) Management Group then tierring is just the ticket. The Operations Manager Command Shell provides explicit support for creating tiers and connecting to tiers.&nbsp;</P>
<P mce_keep="true">&nbsp;</P>
<P>Start by connecting to the Management Group you want to make your top most tier and run the following commands.</P>
<BLOCKQUOTE class=code>
<P>$mgName = "The name for the tier you are creating.";</P>
<P>$msName = "The name of your Root Management Server of the Management Group you would like to tier";</P>
<P>$creds = Get-Credential; # The credentials needed to connect to the Management Group you would like to tier.</P>
<P>$tier = New-Tier -Name: $mgName -ManagementServerName: $msName -Credentials: $creds;</P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P>
<P>That's fairly easy and can be done without using variables. Here is a hypothetical example.</P>
<BLOCKQUOTE class=code>
<P>$creds = Get-Credential; </P>
<P>New-Tier -Name: Building10 -ManagementServerName: building10 -Credentials: $creds</P></BLOCKQUOTE>
<P mce_keep="true">&nbsp;</P>
<P>Now that you have created the tier you need to verify that it works. </P>
<P>Start by creating a connection to the tier you just created.</P>
<BLOCKQUOTE class=code>
<P>$creds = Get-Credential; # The credentials need to connect to the tiered Management Group.</P>
<P>Get-Tier | where {$_.Name -eq "Building10"} | New-ManagementGroupConnection</P>
<P>cd \ # Move to the root of the provider as that is where you will discover all available connections.</P>
<P>dir # List all connections to find the connection you just created.</P>
<P>cd localhost.building10 #&nbsp;Set the location to the connection you just&nbsp;created.&nbsp;</P></BLOCKQUOTE>
<P>Notice that the tiered connection contains the host name of the Root Management Server from which the tier was acquired to help disambiguate a tiered connection from a direct connection to the same Management Group. </P>
<P mce_keep="true">&nbsp;</P>
<P>You can treat a tiered connection just like any other connection to a Management Group. Keep in mind the data is traveling through the Management Group from which the tier was acquired therefore most operations will be significantly slower than working directly with the Management Group. Some operations can be performed across multiple connections. Take a look at <A href="https://blogs.msdn.com/scshell/archive/2007/01/04/one-provider-to-rule-them-all.aspx" mce_href="https://blogs.msdn.com/scshell/archive/2007/01/04/one-provider-to-rule-them-all.aspx">One Provider To Rule Them All!</A> for more info on working with multiple connections.</P>]]></content:encoded>
    </item>
    <item>
      <title>One Provider to Rule Them All!</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/one-provider-to-rule-them-all</link>
      <pubDate>Thu, 04 Jan 2007 01:16:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/01/04/one-provider-to-rule-them-all/</guid>
      <description><![CDATA[Along with a healthy dose of Cmdlets, the Operations Manager snapin (aka "Command...]]></description>
      <content:encoded><![CDATA[<P>Along with a healthy dose of Cmdlets, the Operations Manager snapin (aka "Command Shell")&nbsp;includes a PowerShell Provider that allows you to manage one or more Management Groups at the same time.&nbsp;</P>
<P>To start, create a connection to&nbsp;each Management Group you want to manage. For example...</P>
<BLOCKQUOTE class=code>
<P># Connect directly to a Management Group</P>
<P>New-ManagementGroupConnection mg1.redmond.corp.microsoft.com</P>
<P>or</P>
<P># Connect to a Management Group that is a child tier of the current Management Group.</P>
<P>$creds = Get-Credential</P>
<P>Get-Tier | where {...} | New-ManagementGroupConnection -Credential:$creds</P></BLOCKQUOTE>
<P>Next, move to the root of the Monitoring drive so you can see the connections you have created.</P>
<BLOCKQUOTE class=code>
<P>Monitoring:\...\&gt; cd \</P>
<P>Monitoring:\&gt; dir</P></BLOCKQUOTE>
<P>That's it! </P>
<P>&gt;&gt;All operations from the root of the Monitoring drive will affect all connected Management Groups.&lt;&lt;</P>
<P mce_keep="true">&nbsp;</P>
<P>In case&nbsp;you are wondering how useful this is&nbsp;here are a few examples. </P>
<P>1. Find a Monitoring Object across all of your Management Groups.</P>
<BLOCKQUOTE class=code>
<P>dir -R | where {$_.Name -match "foobar"}</P></BLOCKQUOTE>
<P>2. Install a management pack across all connected&nbsp;Management Groups.</P>
<BLOCKQUOTE class=code>
<P>Install-ManagementPack C:\ManagementPacks\CustomMP.xml</P></BLOCKQUOTE>
<P>3. Get alerts across all connected Management Groups</P>
<BLOCKQUOTE class=code>
<P>Get-Alert ...</P></BLOCKQUOTE>
<P>4. Get events across all connected Management Groups.</P>
<BLOCKQUOTE class=code>
<P>Get-Event ...</P></BLOCKQUOTE>
<P>and so on...</P>
<P mce_keep="true">&nbsp;</P>
<P>Most GET Cmdlets work the same way even though they are spanning multiple connections. Cmdlets that affect change may not work as expected and will usually fail because they are passed an object that is unique to one Management Group.</P>
<P>BE CAREFUL!&nbsp; Objects like ManagementPacks, Classes and Relationship Classes which are unique within one Management Group have the same identifier across all Management Groups and therefore can be inadvertently manipulated across multiple Management Groups when multiple connections exist. </P>
<P>BE VERY CAREFUL! More than one connection to the same Management Group can be created with a different name making it is very easy to inadvertently run the same command against the same Management Group multiple times. </P>]]></content:encoded>
    </item>
    <item>
      <title>Have your PowerShell and our Cmdlets too...</title>
      <link>https://docs.microsoft.com/archive/blogs/scshell/have-your-powershell-and-our-cmdlets-too</link>
      <pubDate>Wed, 03 Jan 2007 02:34:00 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/scshell/2007/01/03/have-your-powershell-and-our-cmdlets-too/</guid>
      <description><![CDATA[Adding the Operations Manager Snapin
As you may already know, the PowerShell is an extensible...]]></description>
      <content:encoded><![CDATA[<H3>Adding the Operations Manager Snapin</H3>
<P class=pbody>As you may already know, the PowerShell is an extensible environment, as such we have tried to create a useful starting point for you by loading the Operations Manager Cmdlets and functions within a PowerShell environment named “Command Shell”. For those of you who need to customize the PowerShell experience the "Command Shell" may not meet your needs.&nbsp;If you want access to Operations Manager Cmdlets from any PowerShell instance you must first load the Operations Manager snapin. Here is an example. 
<BLOCKQUOTE class=pbody>
<P class=code>Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client</P></BLOCKQUOTE>
<P class=pbody>Before you can start using the Operations Manager Cmdlets you must&nbsp;set the location to the root of the Operations Manager snapin. There are&nbsp;several ways of working with a provider. I recommend you create a drive so you can easily work with multiple Operations Manager connections. 
<BLOCKQUOTE class=code>
<P class=code># Set the location to the root of the provider namespace. 
<P class=code>cd OperationsManagerMonitoring:: 
<P class=code mce_keep="true">&nbsp;</P>
<P class=code># or</P>
<P class=code># Create a drive that maps to the root of the provider namespace. 
<P class=code>New-PSDrive -Name: Monitoring -PSProvider: OperationsManagerMonitoring -Root: \ 
<P class=code>cd Monitoring:\</P></BLOCKQUOTE>
<P class=pbody>Now that you are working with the correct provider&nbsp;you can create a connection to the Management Group you intend to manage. 
<BLOCKQUOTE class=code>
<P># Replace 'localhost' with the name of your server if connecting remotely.</P>
<P>New-ManagementGroupConnection localhost&nbsp;</P>
<P>cd localhost</P></BLOCKQUOTE>
<H3>Creating A Console File</H3>
<P class=pbody>That was fairly easy but what if you want to automate these commands every time you start the PowerShell. That requires adding a startup script and/or a console file. I suggest creating a console file to begin with to make the management of snapins easier. 
<P class=pbody>Start by&nbsp;creating a copy of the PowerShell shortcut.&nbsp; 
<P class=pbody>Create a new console file by launching the new shortcut and running the following commands. 
<BLOCKQUOTE class=pbody>
<P class=code>Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client 
<P class=code>Export-Console $home\myconsole</P></BLOCKQUOTE>
<P class=pbody>Close the PowerShell instance and open the properties of the new shortcut.&nbsp;Add the following&nbsp;as a parameter to powershell.exe in the Target field. 
<BLOCKQUOTE class=pbody>
<P class=code>-PSConsoleFile myconsole.psc1</P></BLOCKQUOTE>
<H3>Adding A Startup Script</H3>
<P class=pbody>Now launch the new PowerShell shortcut. You may notice that the Operations Manager startup banner is missing as well as the default connection and all of the Operations Manager functions. The startup banner and functions can also be included in the startup of your custom PowerShell instance by creating a startup script. </P>
<P class=pbody>Start by creating a file called mystartup.ps1 located in $home&nbsp;from within PowerShell. Add the following lines to the startup script to move to the Operations Manager installation directory.</P>
<BLOCKQUOTE class=pbody>
<P class=code>$pf = (gc Env:\ProgramFiles) 
<P class=code>cd "$pf\System Center Operations Manager 2007"</P></BLOCKQUOTE>
<P class=pbody>To add ONLY the Operations Manager functions add the following line to your script. If you decide to go this route you should also consider adding&nbsp;commands to connect to the Management Group you itend to manage. 
<BLOCKQUOTE class=pbody>
<P class=code>.\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.<EM>Functions</EM>.ps1</P></BLOCKQUOTE>
<P class=pbody>To add the Operations Manager functions, the default connection and the startup banner add the following line to your startup script. I suggest using this approach until you are familiar with Operations Manager connection Cmdlets. 
<BLOCKQUOTE class=pbody>
<P class=code>.\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.<EM>Startup</EM>.ps1</P></BLOCKQUOTE>
<P class=pbody>Now you need to call the startup script from your PowerShell shortcut. Open the shortcut properties and add the following arguments at the end of the Target field. 
<BLOCKQUOTE class=pbody>
<P class=code>-NoExit .\mystartup.ps1</P></BLOCKQUOTE>
<P class=pbody>That’s it! Now you can fully customize your powershell startup experiance while still having immediate access to Operations Manager functionality.</P>]]></content:encoded>
    </item>
  </channel>
</rss>