-
-
Save shadeon/4b40e198ee86719ffed6f4483e5a5f83 to your computer and use it in GitHub Desktop.
Sample SCOM management pack that launches the Squared Up from the SCOM console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ManagementPack SchemaVersion="2.0" ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<Manifest> | |
<Identity> | |
<ID>LaunchSquaredUp</ID> | |
<Version>1.0.0.0</Version> | |
</Identity> | |
<Name>LaunchSquaredUp</Name> | |
<References> | |
<Reference Alias="Windows"> | |
<ID>Microsoft.Windows.Library</ID> | |
<Version>7.5.8501.0</Version> | |
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken> | |
</Reference> | |
<Reference Alias="System"> | |
<ID>System.Library</ID> | |
<Version>7.5.8501.0</Version> | |
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken> | |
</Reference> | |
</References> | |
</Manifest> | |
<Categories> | |
<Category ID="LaunchSquaredUp.ConsoleTask.LaunchFromAlert.Category" Target="LaunchSquaredUp.ConsoleTask.LaunchFromAlert" Value="System!System.Internal.ManagementPack.ConsoleTasks.Alert" /> | |
<Category ID="LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject.Category" Target="LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject" Value="System!System.Internal.ManagementPack.ConsoleTasks.Alert" /> | |
<Category ID="LaunchSquaredUp.ConsoleTask.LaunchFromComputer.Category" Target="LaunchSquaredUp.ConsoleTask.LaunchFromComputer" Value="System!System.Internal.ManagementPack.ConsoleTasks.MonitoringObject" /> | |
</Categories> | |
<Presentation> | |
<ConsoleTasks> | |
<ConsoleTask ID="LaunchSquaredUp.ConsoleTask.LaunchFromAlert" Accessibility="Public" Enabled="true" Target="System!System.Entity" RequireOutput="false"> | |
<Assembly>Res.LaunchSquaredUp.ConsoleTask.LaunchFromAlert</Assembly> | |
<Handler>ShellHandler</Handler> | |
<Parameters> | |
<Argument Name="WorkingDirectory" /> | |
<Argument Name="Application">cmd</Argument> | |
<Argument>/C "start http://squpnightly/SquaredUpv3/drilldown/scomalert?id=$Id$"</Argument> | |
</Parameters> | |
</ConsoleTask> | |
<ConsoleTask ID="LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject" Accessibility="Public" Enabled="true" Target="System!System.Entity" RequireOutput="false"> | |
<Assembly>Res.LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject</Assembly> | |
<Handler>ShellHandler</Handler> | |
<Parameters> | |
<Argument Name="WorkingDirectory" /> | |
<Argument Name="Application">cmd</Argument> | |
<Argument>/C "start http://squpnightly/SquaredUpv3/drilldown/scomobject?id=$MonitoringObjectId$"</Argument> | |
</Parameters> | |
</ConsoleTask> | |
<ConsoleTask ID="LaunchSquaredUp.ConsoleTask.LaunchFromComputer" Accessibility="Public" Enabled="true" Target="Windows!Microsoft.Windows.Computer" RequireOutput="false"> | |
<Assembly>Res.Microsoft.Windows.Server.Computer.OpenPowerShell</Assembly> | |
<Handler>ShellHandler</Handler> | |
<Parameters> | |
<Argument Name="WorkingDirectory" /> | |
<Argument Name="Application">powershell.exe </Argument> | |
<Argument>-noprofile -Command "& { <![CDATA[Param([String]$computerFQDN) | |
$mgArgs = @{} | |
$sdkService = Get-Service -Name omsdk -ErrorAction SilentlyContinue | |
if ( $sdkService -eq $null -or $sdkService.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) | |
{ | |
$key = 'HKCU:Software\Microsoft\Microsoft Operations Manager\3.0\User Settings' | |
$mgArgs['ComputerName'] = (Get-ItemProperty -Path $key -Name SDKServiceMachine).SdkServiceMachine | |
$credsRequired = (Get-ItemProperty -Path $key -Name SDKServiceMachineRequiresCredentials -ErrorAction SilentlyContinue).SDKServiceMachineRequiresCredentials | |
if ($credsRequired -ne $null -and $credsRequired -eq 'True') | |
{ | |
$mgArgs['Credential'] = Get-Credential -Message 'Please provide credentials to connect to SCOM.' | |
} | |
} | |
Import-Module OperationsManager | |
New-SCOMManagementGroupConnection @mgArgs | |
## Get Windows Computer class | |
$computerClass = Get-SCOMClass -Name 'Microsoft.Windows.Computer' | |
## Get SCOM object | |
$scomObject = (Get-SCOMClass -Name Microsoft.Windows.Computer| Get-SCOMClassInstance | where {$_.FullName -eq ('Microsoft.Windows.Computer:' + $computerFQDN)}) | |
if ($scomObject -ne $null) | |
{ | |
Start-Process -FilePath ('http://squpnightly/SquaredUpv3/drilldown/scomobject?id=' + $scomObject.Id) | |
} | |
]]> }"</Argument> | |
<Argument>"$Target/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$"</Argument> | |
</Parameters> | |
</ConsoleTask> | |
</ConsoleTasks> | |
</Presentation> | |
<LanguagePacks> | |
<LanguagePack ID="ENU" IsDefault="true"> | |
<DisplayStrings> | |
<DisplayString ElementID="LaunchSquaredUp"> | |
<Name>Launch Squared Up Console Tasks</Name> | |
<Description>Adds console tasks that let you open Squared Up from the SCOM console.</Description> | |
</DisplayString> | |
<DisplayString ElementID="LaunchSquaredUp.ConsoleTask.LaunchFromAlert"> | |
<Name>View alert in Squared Up</Name> | |
<Description>Opens the alert in Squared Up using your default browser.</Description> | |
</DisplayString> | |
<DisplayString ElementID="LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject"> | |
<Name>View Object in Squared Up</Name> | |
<Description>Opens the object in Squared Up using your default browser.</Description> | |
</DisplayString> | |
<DisplayString ElementID="LaunchSquaredUp.ConsoleTask.LaunchFromComputer"> | |
<Name>View computer in Squared Up</Name> | |
<Description>Opens the computer in Squared Up using your default browser.</Description> | |
</DisplayString> | |
</DisplayStrings> | |
<KnowledgeArticles></KnowledgeArticles> | |
</LanguagePack> | |
</LanguagePacks> | |
<Resources> | |
<Assembly ID="Res.LaunchSquaredUp.ConsoleTask.LaunchFromAlert" Accessibility="Public" FileName="LaunchSquaredUp.ConsoleTask.LaunchFromAlert" HasNullStream="true" QualifiedName="LaunchSquaredUp.ConsoleTask.LaunchFromAlert" /> | |
<Assembly ID="Res.LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject" Accessibility="Public" FileName="LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject" HasNullStream="true" QualifiedName="LaunchSquaredUp.ConsoleTask.LaunchFromAlertObject" /> | |
<Assembly ID="Res.Microsoft.Windows.Server.Computer.OpenPowerShell" Accessibility="Public" FileName="Microsoft.Windows.Server.Computer.OpenPowerShell" HasNullStream="true" QualifiedName="Microsoft.Windows.Server.Computer.OpenPowerShell" /> | |
</Resources> | |
</ManagementPack> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment