Res.CiscoImcScom (DeployableResource)

Element properties:

TypeDeployableResource
File NameCiscoImcScom.psm1
AccessibilityPublic

Source Code:

<DeployableResource ID="Res.CiscoImcScom" FileName="CiscoImcScom.psm1" Accessibility="Public" HasNullStream="false"/>

File Content: CiscoImcScom.psm1

Function Add-ImcScomGroup()

{
Param
(
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$GroupName,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$GroupDescription,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[string]$MultiIpAddressRange,

[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[string]$IpRangeStartAddress,

[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[string]$IpRangeEndAddress,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[string]$ExcludeIpList,

[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$NetworkAddress,

[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$SubnetMask,

[Parameter(ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[switch]$NoSsl,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[int]$Port,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[ValidateSet("Agent Managed Computer (Trusted Boundary)", "Agent Managed Computer (Untrusted Boundary)", "Management Server", "Gateway Server")]
[string]$MachineType,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$MachineName,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[Microsoft.EnterpriseManagement.Configuration.ManagementPack]$ExistingManagementPack,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$ProxyHost,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[int]$ProxyPort,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$ProxyUsername,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$ProxyPassword,

[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[string]$ExistingRunAsAccount,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[string]$RunAsAccount,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[System.Management.Automation.PSCredential]$RunAsCredential,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRangeWithNewRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithExistingRunAsAccount')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMaskWithNewRunAsAccount')]
[ValidateSet("IPv4", "IPv6")]
[string]$AddressType
)

Import-Module OperationsManager

$mgmtGroup = Get-SCOMManagementGroup
if($mgmtGroup -eq $null)
{
Write-Host "ERROR: Could not connect to management group"
return
}

$template = $mgmtGroup.Templates.GetTemplates((New-Object 'Microsoft.EnterpriseManagement.Configuration.ManagementPackTemplateCriteria'("Name = 'Cisco.Imc.Template'")))[0]
if($template -eq $null)
{
Write-Host "ERROR: 'Cisco.Imc.Template' not available"
return
}

#Verify proxy details
if(($PSBoundParameters.ContainsKey('ProxyUsername') -or $PSBoundParameters.ContainsKey('ProxyPassword') -or $PSBoundParameters.ContainsKey('ProxyPort')) -and !$PSBoundParameters.ContainsKey('ProxyHost'))
{
Write-Host "Please provide 'ProxyHost'"
return
}
if($PSBoundParameters.ContainsKey('ProxyPassword') -and !$PSBoundParameters.ContainsKey('ProxyUsername'))
{
Write-Host "Please provide 'ProxyUsername'"
return
}

$machine = $null
switch ($MachineType)
{
{ @("Agent Managed Computer (Trusted Boundary)","Agent Managed Computer (Untrusted Boundary)") -contains $_ }
{
$machine = Get-SCOMAgent -Name "$MachineName"
if($machine -eq $null)
{
Write-Host "ERROR: Could not connect to the agent machine '$MachineName'. Provide a valid MachineName."
return
}
}
{ @("Management Server","Gateway Server") -contains $_ }
{
$machine = Get-SCOMManagementServer -Name "$MachineName"
if($machine -eq $null)
{
Write-Host "ERROR: Could not connect to the server machine '$MachineName'. Provide a valid MachineName."
return
}
}
}

#Verify ExistingManagementPack
if($PSBoundParameters.ContainsKey('ExistingManagementPack'))
{
if($ExistingManagementPack.Sealed -eq $true)
{
$displayNameForMp = $ExistingManagementPack.DisplayName
Write-Host "Management Pack '$displayNameForMp' is sealed. Provide an unsealed management pack."
return
}
if($ExistingManagementPack.Name -ieq 'Microsoft.SystemCenter.OperationsManager.DefaultUser')
{
Write-Host "Default Management Pack can not be used to create instance. Provide a valid management pack."
return
}
}
else
{
$mpList = Get-SCOMManagementPack -DisplayName $GroupName.Trim()
if($mpList -ne $null)
{
Write-Host "Management Pack with display name '$GroupName' already exists. Provide a new GroupName or an existing management pack as parameter."
return
}
}

#Verify GroupName
$InstanceName = $GroupName.Trim()
$dispNames = @()
$template.GetFolders() | % {$_.GetSubFolders()} | %{ $dispNames += $_.DisplayName }

if($dispNames -Contains $InstanceName)
{
Write-Host "Group with name '$InstanceName' already exists. Provide a new GroupName."
return
}

$RunAsAccountName = ""
$AssocRunAsAccount = "false"
#Verify Run As Account details
if(($PSCmdlet.ParameterSetName -ieq 'MultiIpAddressRangeWithNewRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'IpAddressRangeWithNewRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'SubnetMaskWithNewRunAsAccount'))
{
$account = Get-SCOMRunAsAccount -Name "$RunAsAccount"
if($account -ne $null)
{
Write-Host "Run As Account with name '$RunAsAccount' already exists. Please provide a new account name."
return
}
$RunAsAccountName = $RunAsAccount
$AssocRunAsAccount = "true"
}
elseif($PSBoundParameters.ContainsKey('ExistingRunAsAccount'))
{
$account = Get-SCOMRunAsAccount -Name "$ExistingRunAsAccount"
if($account -eq $null)
{
Write-Host "Run As Account '$ExistingRunAsAccount' does not exist. Please provide a valid account name."
return
}
$RunAsAccountName = $ExistingRunAsAccount
$AssocRunAsAccount = "true"
}

$prxUrl = [string]::Empty
$prxUsername = [string]::Empty
$prxPassword = [string]::Empty
if($PSBoundParameters.ContainsKey('ProxyHost'))
{
$prxUrl = "http://" + $ProxyHost
if($PSBoundParameters.ContainsKey('ProxyPort'))
{
$prxUrl += ":" + $ProxyPort
}
else
{
$prxUrl += ":80"
}

if($PSBoundParameters.ContainsKey('ProxyUsername'))
{
$prxUsername = $ProxyUsername
if($PSBoundParameters.ContainsKey('ProxyPassword'))
{
try
{
$asmbly = [System.Reflection.Assembly]::LoadWithPartialName("Cisco.Ucs.MP.UI")
if(($asmbly -eq $null) -or ($asmbly.GetType("Cisco.Ucs.MP.UI.Classes.Security") -eq $null))
{
Write-Host "Could not load the assembly 'Cisco.Ucs.MP.UI'"
return
}
$prxPassword = [Cisco.Ucs.MP.UI.Classes.Security]::Encrypt($prxUrl, $prxUsername, $ProxyPassword)
}
catch
{
Write-Host "Could not load the assembly 'Cisco.Ucs.MP.UI'"
$_
return
}
}
}
}

[int]$machineTypeId = 2
switch ($MachineType)
{
"Agent Managed Computer (Trusted Boundary)" { $machineTypeId = 0 }
"Agent Managed Computer (Untrusted Boundary)" { $machineTypeId = 1 }
"Management Server" { $machineTypeId = 2 }
"Gateway Server" { $machineTypeId = 3 }
}

$baseMp = Get-SCOMManagementPack -Name 'Cisco.UCS.CSeries'
$newMp = $null
if($PSBoundParameters.ContainsKey('ExistingManagementPack'))
{
$newMp = $ExistingManagementPack
}
else
{
#Check for uniqueness of provided template name
$processedName = [System.Text.RegularExpressions.Regex]::Replace([System.Text.RegularExpressions.Regex]::Replace([System.Text.RegularExpressions.Regex]::Replace($GroupName.Trim(), "[^\w\s\.]+", ""),"^[\d_\s\.]+", ""), "[\s\.]+", ".")

$uniqueMpName = $processedName
$existingMp = $null
[int]$suffix = 1
do
{
$existingMp = $null
$existingMp = Get-SCOMManagementPack -Name $uniqueMpName
if($existingMp -ne $null)
{
$uniqueMpName = $processedName + $suffix
$suffix++
}
}
while($existingMp -ne $null)

$newMp = New-Object 'Microsoft.EnterpriseManagement.Configuration.ManagementPack'($uniqueMpName, $GroupName, $baseMp.Version, $mgmtGroup)
$newMp.DisplayName = $GroupName

if($PSBoundParameters.ContainsKey('GroupDescription'))
{
$newMp.Description = $GroupDescription
}

$mgmtGroup.ManagementPacks.ImportManagementPack($newMp)
}

$scanMode = ''
$ipAddressRange = ''
if(($PSCmdlet.ParameterSetName -ieq 'MultiIpAddressRangeWithExistingRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'MultiIpAddressRangeWithNewRunAsAccount'))
{
$scanMode = 'MultiIpAddressRange'
$ipAddressRange = $MultiIpAddressRange
}
elseif(($PSCmdlet.ParameterSetName -ieq 'IpAddressRangeWithExistingRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'IpAddressRangeWithNewRunAsAccount'))
{
$scanMode = 'IpAddressRange'
$ipAddressRange = $IpRangeStartAddress + '-' + $IpRangeEndAddress
}
elseif(($PSCmdlet.ParameterSetName -ieq 'SubnetMaskWithExistingRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'SubnetMaskWithNewRunAsAccount'))
{
$scanMode = 'SubnetMask'
$ipAddressRange = $NetworkAddress + '-' + $SubnetMask
}

$excludeIpListValue = ''
if($PSBoundParameters.ContainsKey('ExcludeIpList'))
{
$excludeIpListValue = $ExcludeIpList
}

$noSslValue = 'https://'
if($PSBoundParameters.ContainsKey('NoSsl'))
{
$noSslValue = 'http://'
}

$portToUse
if($PSBoundParameters.ContainsKey('Port'))
{
$portToUse = $Port
}
elseif($PSBoundParameters.ContainsKey('NoSsl'))
{
$portToUse = 80
}
else
{
$portToUse = 443
}

$typeGuid = [System.Guid]::NewGuid().ToString("N")
$webProxyUrl = "http://" + $MachineName + ":8732/UcsMonitoringService"
$sb = New-Object System.Text.StringBuilder
[System.Xml.XmlWriter]$configurationWriter = [System.Xml.XmlWriter]::Create($sb)
$configurationWriter.WriteStartElement("Configuration")
$configurationWriter.WriteElementString("TypeId", $typeGuid)
$configurationWriter.WriteElementString("LocaleId", "ENU")
$configurationWriter.WriteElementString("GroupName", $GroupName)
$configurationWriter.WriteElementString("Description", $GroupDescription)
$configurationWriter.WriteElementString("ScanMode", $scanMode)
$configurationWriter.WriteElementString("NoSsl", $noSslValue)
$configurationWriter.WriteElementString("IpAddressRange", $ipAddressRange)
$configurationWriter.WriteElementString("ExcludeIpList", $excludeIpListValue)
$configurationWriter.WriteElementString("ServerName", $MachineName)
$configurationWriter.WriteElementString("WebProxyUrl", $webProxyUrl)
$configurationWriter.WriteElementString("Ampersand", "")
$configurationWriter.WriteElementString("PortNumber", $portToUse)
$configurationWriter.WriteElementString("ProxyUrl", $prxUrl)
$configurationWriter.WriteElementString("ProxyUserName", $prxUsername)
$configurationWriter.WriteElementString("ProxyPassword", $prxPassword)
$configurationWriter.WriteElementString("MachineType", $machineTypeId)
$configurationWriter.WriteElementString("RunAsAccountName", $RunAsAccountName)
$configurationWriter.WriteElementString("AssocRunAsAccount", $AssocRunAsAccount)
$configurationWriter.WriteElementString("AddressType", $AddressType)
$configurationWriter.WriteEndElement()
$configurationWriter.Flush()

try
{
$buffer = $newMp.ProcessTemplate($template, $sb.ToString(), "TemplateoutputCiscoImcTemplate" + $typeGuid, $GroupName, "")
}
catch
{
$_ #throw the exception as it is
return #do not try to associate account
}


if(($PSCmdlet.ParameterSetName -ieq 'MultiIpAddressRangeWithNewRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'IpAddressRangeWithNewRunAsAccount') -or ($PSCmdlet.ParameterSetName -ieq 'SubnetMaskWithNewRunAsAccount'))
{
$account = Add-SCOMRunAsAccount -Simple -Name "$RunAsAccount" -Description "$GroupName" -RunAsCredential $RunAsCredential
if($account -eq $null)
{
Write-Host "Error occurred while creating Run As Account '$RunAsAccount'. Please create and associate the Run As Account manually."
return
}

$account | Set-SCOMRunAsDistribution -MoreSecure -SecureDistribution $machine
$profile = Get-SCOMRunAsProfile -DisplayName "$GroupName Profile"
if($profile -eq $null)
{
Write-Host "Error occurred while associating the Run As Account to '$GroupName Profile'. Please associate manually."
}
else
{
Set-SCOMRunAsProfile -Action "Add" -Profile $profile -Account $account
}
}
elseif($PSBoundParameters.ContainsKey('ExistingRunAsAccount'))
{
$account = Get-SCOMRunAsAccount -Name "$ExistingRunAsAccount"
if($account -eq $null)
{
Write-Host "Error occurred while associating the Run As Account '$ExistingRunAsAccount'. Please associate the Run As Account manually."
}
else
{
$profile = Get-SCOMRunAsProfile -DisplayName "$GroupName Profile"
if($profile -eq $null)
{
Write-Host "Error occurred while associating the Run As Account to '$GroupName Profile'. Please associate manually."
}
else
{
Set-SCOMRunAsProfile -Action "Add" -Profile $profile -Account $account
}
}
}
}

Function Update-ImcScomGroup()
{
[CmdletBinding(DefaultParameterSetName='Default')]
Param
(
[Parameter(Mandatory=$true, ParameterSetName='Default')]
[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$true, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$true, ParameterSetName='SubnetMask')]
[string]$GroupName,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[string]$GroupDescription,

[Parameter(Mandatory=$true, ParameterSetName='MultiIpAddressRange')]
[string]$MultiIpAddressRange,

[Parameter(Mandatory=$true, ParameterSetName='IpAddressRange')]
[string]$IpRangeStartAddress,

[Parameter(Mandatory=$true, ParameterSetName='IpAddressRange')]
[string]$IpRangeEndAddress,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[string]$ExcludeIpList,

[Parameter(Mandatory=$true, ParameterSetName='SubnetMask')]
[string]$NetworkAddress,

[Parameter(Mandatory=$true, ParameterSetName='SubnetMask')]
[string]$SubnetMask,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[bool]$Secure,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[int]$Port,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[ValidateSet("Agent Managed Computer (Trusted Boundary)", "Agent Managed Computer (Untrusted Boundary)", "Management Server", "Gateway Server")]
[string]$MachineType,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[string]$MachineName,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[string]$ProxyHost,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[int]$ProxyPort,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[string]$ProxyUsername,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[string]$ProxyPassword,

[Parameter(Mandatory=$false, ParameterSetName='Default')]
[Parameter(Mandatory=$false, ParameterSetName='MultiIpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='IpAddressRange')]
[Parameter(Mandatory=$false, ParameterSetName='SubnetMask')]
[Parameter(Mandatory=$false)]
[ValidateSet("IPv4", "IPv6")]
[string]$AddressType
)

Import-Module OperationsManager

$mgmtGroup = Get-SCOMManagementGroup
if($mgmtGroup -eq $null)
{
Write-Host "ERROR: Could not connect to management group"
return
}

$template = $mgmtGroup.Templates.GetTemplates((New-Object 'Microsoft.EnterpriseManagement.Configuration.ManagementPackTemplateCriteria'("Name = 'Cisco.Imc.Template'")))[0]
if($template -eq $null)
{
Write-Host "ERROR: 'Cisco.Imc.Template' not available"
return
}

$GroupName = $GroupName.Trim()
$managementPack = $null
$templateFolder = $null
$allCiscoMps = Get-SCOMManagementPack | ? { $_.References.ContainsKey('CiscoUCSCSeries') }
foreach($ciscoMp in $allCiscoMps)
{
$templateFolder = $ciscoMp.GetFolders() | ? { $_.Name.StartsWith("TemplateoutputCiscoImcTemplate") -and $_.DisplayName -ieq $GroupName }
if($templateFolder -ne $null)
{
$managementPack = $ciscoMp
break
}
}

$imcMp = Get-SCOMManagementPack -Name "Cisco.UCS.CSeries"

if($templateFolder -eq $null)
{
Write-Host "ERROR: Could not fetch the template folder for group $GroupName"
return
}
if($managementPack -eq $null)
{
Write-Host "ERROR: Could not fetch the Management Pack for group $GroupName"
return
}

$instanceDiscoveries = Get-SCOMDiscovery -DisplayName 'IMC Servers Group Discovery' | ?{ $_.Identifier.Domain[0] -eq $managementPack.Name }
if($instanceDiscoveries.Count -eq 0 )
{
$instanceDiscoveries = Get-SCOMDiscovery -DisplayName 'IMC Servers (Group) Discovery' | ?{ $_.Identifier.Domain[0] -eq $managementPack.Name }
}
$config = $null
#there can be multiple instance discoveries in MP. So iterating upon this variable
foreach($instanceDiscovery in $instanceDiscoveries)
{
$config = [xml]("<Config>" + $instanceDiscovery.DataSource.Configuration + "</Config>")
if($config.Config.GroupName -ieq $GroupName)
{
break
}
$config = $null
}

if($config -eq $null)
{
Write-Host "ERROR: Could not fetch configuration for group $GroupName"
return
}

$typeIdValue = $config.Config.TypeId
$scanModeValue = $config.Config.ScanMode
$noSslValue = $config.Config.NoSsl
$ipAddressRangeValue = $config.Config.IpAddressRange
$excludeIpListValue = $config.Config.ExcludeIpList
$serverNameValue = $config.Config.ServerName
$webProxyUrlValue = $config.Config.WebProxyUrl
$portValue = $config.Config.PortNumber
$prxUrlValue = $config.Config.ProxyUrl
$prxUserNameValue = $config.Config.ProxyUserName
$prxPasswordValue = $config.Config.ProxyPassword
$MachineTypeId = $config.Config.MachineType
$RunAsAccountName = $config.Config.RunAsAccountName
$AssocRunAsAccount = $config.Config.AssocRunAsAccount
$descriptionValue = $config.Config.Description
$addressTypeValue = $config.Config.AddressType

$oldprxUrlValue = $prxUrlValue
$oldprxUserNameValue = $prxUserNameValue

if($PSBoundParameters.ContainsKey('GroupDescription'))
{
$descriptionValue = $GroupDescription
}
if($PSBoundParameters.ContainsKey('ProxyHost') -and $PSBoundParameters.ContainsKey('ProxyPort'))
{
$prxUrlValue = "http://" + $ProxyHost + ":" + $ProxyPort
}
elseif($PSBoundParameters.ContainsKey('ProxyHost'))
{
$prxUrlValue = "http://" + $ProxyHost + ":" + $prxUrlValue.Substring($prxUrlValue.LastIndexOf(":") + 1)
}
elseif($PSBoundParameters.ContainsKey('ProxyPort'))
{
$prxUrlValue = "http://" + $prxUrlValue.Substring($prxUrlValue.IndexOf("://") + 3, $prxUrlValue.LastIndexOf(":") - $prxUrlValue.IndexOf("://") - 3) + ":" + $ProxyPort
}

if($PSBoundParameters.ContainsKey('ProxyUsername'))
{
$prxUserNameValue = $ProxyUsername
}
if($PSBoundParameters.ContainsKey('ProxyPassword'))
{
try
{
$asmbly = [System.Reflection.Assembly]::LoadWithPartialName("Cisco.Ucs.MP.UI")
if(($asmbly -eq $null) -or ($asmbly.GetType("Cisco.Ucs.MP.UI.Classes.Security") -eq $null))
{
Write-Host "ERROR: Could not update the Management Pack $GroupName. Assembly 'Cisco.Ucs.MP.UI' not available."
return
}
$prxPasswordValue = [Cisco.Ucs.MP.UI.Classes.Security]::Encrypt($prxUrlValue, $prxUserNameValue, $ProxyPassword)
}
catch
{
Write-Host "ERROR: Could not update the Management Pack $GroupName. Could not process proxy password."
$_
return
}
}
elseif($prxPasswordValue -ne "") #anyways encrypt the proxy password (useful in case the template was created by a previous version of MP. Also required if proxy url or proxy username has changed)
{
try
{
$asmbly = [System.Reflection.Assembly]::LoadWithPartialName("Cisco.Ucs.MP.UI")
if(($asmbly -ne $null) -and ($asmbly.GetType("Cisco.Ucs.MP.UI.Classes.Security") -ne $null))
{
$decryptedPassword = [Cisco.Ucs.MP.UI.Classes.Security]::TryDecrypt($oldprxUrlValue, $oldprxUserNameValue, $prxPasswordValue)
$prxPasswordValue = [Cisco.Ucs.MP.UI.Classes.Security]::Encrypt($prxUrlValue, $prxUserNameValue, $decryptedPassword)
}
}
catch
{
Write-Host "ERROR: Could not process proxy password. Please update the proxy password manually from the Operations Console."
}
}

if($PSBoundParameters.ContainsKey('ExcludeIpList'))
{
$excludeIpListValue = $ExcludeIpList
}

if($PSBoundParameters.ContainsKey('Secure'))
{
if($Secure -eq $true)
{
$noSslValue = 'https://'
}
else
{
$noSslValue = 'http://'
}
}
if($PSBoundParameters.ContainsKey('Port'))
{
$portValue = $Port
}
if($PSBoundParameters.ContainsKey('MachineName'))
{
$serverNameValue = $MachineName
$webProxyUrlValue = "http://" + $MachineName + ":8732/UcsMonitoringService"
}

if($PSCmdlet.ParameterSetName -ieq 'MultiIpAddressRange')
{
$scanModeValue = 'MultiIpAddressRange'
$ipAddressRangeValue = $MultiIpAddressRange
}
elseif($PSCmdlet.ParameterSetName -ieq 'IpAddressRange')
{
$scanModeValue = 'IpAddressRange'
$ipAddressRangeValue = $IpRangeStartAddress + '-' + $IpRangeEndAddress
}
elseif($PSCmdlet.ParameterSetName -ieq 'SubnetMask')
{
$scanModeValue = 'SubnetMask'
$ipAddressRangeValue = $NetworkAddress + '-' + $SubnetMask
}

if($PSBoundParameters.ContainsKey('MachineType'))
{
switch ($MachineType)
{
"Agent Managed Computer (Trusted Boundary)" { $MachineTypeId = 0 }
"Agent Managed Computer (Untrusted Boundary)" { $MachineTypeId = 1 }
"Management Server" { $MachineTypeId = 2 }
"Gateway Server" { $MachineTypeId = 3 }
}
}

if($PSBoundParameters.ContainsKey('AddressType'))
{
$addressTypeValue = $AddressType
}

$sb = New-Object System.Text.StringBuilder
[System.Xml.XmlWriter]$configurationWriter = [System.Xml.XmlWriter]::Create($sb)
$configurationWriter.WriteStartElement("Configuration")
$configurationWriter.WriteElementString("TypeId", $typeIdValue)
$configurationWriter.WriteElementString("LocaleId", "ENU")
$configurationWriter.WriteElementString("GroupName", $GroupName)
$configurationWriter.WriteElementString("Description", $descriptionValue)
$configurationWriter.WriteElementString("ScanMode", $scanModeValue)
$configurationWriter.WriteElementString("NoSsl", $noSslValue)
$configurationWriter.WriteElementString("IpAddressRange", $ipAddressRangeValue)
$configurationWriter.WriteElementString("ExcludeIpList", $excludeIpListValue)
$configurationWriter.WriteElementString("ServerName", $serverNameValue)
$configurationWriter.WriteElementString("WebProxyUrl", $webProxyUrlValue)
$configurationWriter.WriteElementString("Ampersand", "&")
$configurationWriter.WriteElementString("PortNumber", $portValue)
$configurationWriter.WriteElementString("ProxyUrl", $prxUrlValue)
$configurationWriter.WriteElementString("ProxyUserName", $prxUserNameValue)
$configurationWriter.WriteElementString("ProxyPassword", $prxPasswordValue)
$configurationWriter.WriteElementString("MachineType", $MachineTypeId)
$configurationWriter.WriteElementString("RunAsAccountName", $RunAsAccountName)
$configurationWriter.WriteElementString("AssocRunAsAccount", $AssocRunAsAccount)
$configurationWriter.WriteElementString("AddressType", $addressTypeValue)
$configurationWriter.WriteEndElement()
$configurationWriter.Flush()

try
{
$managementPack.Version = $imcMp.Version
$temp = $managementPack.ProcessTemplate($template, $sb.ToString(), $templateFolder.Name, $GroupName, "")
}
catch
{
Write-Host "ERROR: Could not update the group $GroupName. EXCEPTION: " + $_.Exception
}
}

#Update All IMC Group SCOM All Instances
Function Update-ImcGroupScomAllInstances()
{
Import-Module OperationsManager
$mps = Get-SCOMManagementPack | ? { $_.References.ContainsKey('CiscoUCSCSeries') }
if($mps -ne $null -and $mps.Count -gt 0)
{
$count = $mps.Count
$counter = 1
Write-Host "Total number of configured IMC Group instances: $count"

foreach($mp in $mps)
{
Write-Host "Updating IMC Group instance( $counter/$count ):" $mp.DisplayName
Update-ImcScomGroup -GroupName $mp.DisplayName
$counter++
}
}
else
{
Write-Host "There are no configured IMC Group instances to update"
}
}

Function Get-ImcScomRule()
{
Param
(
[Parameter(Mandatory=$false)]
[string[]]$Class,

#FaultCode associated with rule
[Parameter(Mandatory=$false)]
[string[]]$FaultCode
)

Import-Module OperationsManager
$mgmtGroup = Get-SCOMManagementGroup
if($mgmtGroup -eq $null)
{
Write-Host "ERROR: Could not connect to management group"
return
}

$managementPack = Get-SCOMManagementPack -Name 'Cisco.Ucs.Core.Library'

if($managementPack -eq $null)
{
Write-Host "ERROR: Could not fetch the Management Pack 'Cisco.Ucs.Core.Library'"
return
}

#rules are targeted to parent classes in Core Library. Users see the child classes (derived from these, and present in template MP). So we need to map these child class names to parent class names for cmdlet to work
$childParentClassMapping = @{}
$childParentClassMapping.Add("IMC Server Group","IMC Server")
$childParentClassMapping.Add("IMC Chassis","Chassis")


$processedClassNames = @()

if($PSBoundParameters.ContainsKey('Class'))
{
$Class | %{
if($childParentClassMapping.Contains($_))
{ $processedClassNames += $childParentClassMapping[$_] }
else
{ $processedClassNames += $_ }
}
}

if($PSBoundParameters.ContainsKey('Class') -or $PSBoundParameters.ContainsKey('FaultCode'))
{
$finalRules = @()
Get-SCOMRule -ManagementPack $managementPack | ?{ ( $_.Name.StartsWith("Cisco.Imc.Chassis.F") -or $_.Name.StartsWith("Cisco.Imc.Server.F") )} | %{
$classObject = Get-SCOMClass -Id $_.Target.Id
$className = $classObject.DisplayName
$ruleFaultCode = $_.Name.Split('.')[3]
if($PSBoundParameters.ContainsKey('Class') -and $PSBoundParameters.ContainsKey('FaultCode'))
{
if($processedClassNames -Contains $className -and $FaultCode -Contains $ruleFaultCode)
{
$finalRules += $_
}
}
elseif($PSBoundParameters.ContainsKey('Class'))
{
if($processedClassNames -Contains $className)
{
$finalRules += $_
}
}
elseif($PSBoundParameters.ContainsKey('FaultCode'))
{
if($FaultCode -Contains $ruleFaultCode)
{
$finalRules += $_
}
}
}
$finalRules
}
else
{
Get-SCOMRule -ManagementPack $managementPack | ?{ $_.Name.StartsWith("Cisco.Imc.Chassis.F") -or $_.Name.StartsWith("Cisco.Imc.Server.F")}
}
}

Function Enable-ImcScomRule()
{
Param
(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[Microsoft.EnterpriseManagement.Configuration.ManagementPackRule[]]$Rule,

#Display Name of Management Pack which will contain overrides
[Parameter(Mandatory=$true)]
[string]$ManagementPackName
)

begin
{
Import-Module OperationsManager
$mpForOverrides = Get-SCOMManagementPack -DisplayName "$ManagementPackName"
if($mpForOverrides -eq $null)
{
Write-Host "ERROR: Management Pack $ManagementPackName does not exist"
return
}
}

process
{
#Check if rules belong to Cisco MP
$mgmtPack = $Rule[0].GetManagementPack()
if(!$mgmtPack.Name.Equals('Cisco.Ucs.Core.Library'))
{
$mpName = $mgmtPack.Name
Write-Host "ERROR: Rule belongs to Management Pack '$mpName' which is not supported by this cmdlet"
return
}

$mpForOverrides = Get-SCOMManagementPack -DisplayName "$ManagementPackName"
if($mpForOverrides -eq $null)
{
return
}

$Rule | %{
$displayName = $_.DisplayName
#Check if the rule's 'enabled' property is overridden
$override = $null
Get-SCOMOverride -Rule $_ | %{
if($_.Property -ieq 'enabled')
{
if($_.Value -ieq 'false') { $override = $false }
elseif($_.Value -ieq 'true') { $override = $true }
}
}

#Enable the rule if required
if(($override -eq $false) -or (($override -eq $null) -and ($_.Enabled -ieq 'false')))
{
Write-Host "Enabling rule '$displayName'"
Enable-SCOMRule -ManagementPack $mpForOverrides -Rule $_
}
else
{
Write-Host "Rule '$displayName' is already enabled"
}
}
}
}

Function Disable-ImcScomRule()
{
Param
(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[Microsoft.EnterpriseManagement.Configuration.ManagementPackRule[]]$Rule,

#Display Name of Management Pack which will contain overrides
[Parameter(Mandatory=$true)]
[string]$ManagementPackName
)

begin
{
Import-Module OperationsManager
$mpForOverrides = Get-SCOMManagementPack -DisplayName "$ManagementPackName"
if($mpForOverrides -eq $null)
{
Write-Host "ERROR: Management Pack $ManagementPackName does not exist"
return
}
}

process
{
#Check if rules belong to Cisco MP
$mgmtPack = $Rule[0].GetManagementPack()
if(!$mgmtPack.Name.Equals('Cisco.Ucs.Core.Library'))
{
$mpName = $mgmtPack.Name
Write-Host "ERROR: Rule belongs to Management Pack '$mpName' which is not supported by this cmdlet"
return
}

$mpForOverrides = Get-SCOMManagementPack -DisplayName "$ManagementPackName"
if($mpForOverrides -eq $null)
{
return
}

$Rule | %{
$displayName = $_.DisplayName
#Check if the rule's 'enabled' property is overridden
$override = $null
Get-SCOMOverride -Rule $_ | %{
if($_.Property -ieq 'enabled')
{
if($_.Value -ieq 'false') { $override = $false }
elseif($_.Value -ieq 'true') { $override = $true }
}
}

#Disable the rule if required
if(($override -eq $true) -or (($override -eq $null) -and ($_.Enabled -ieq 'true')))
{
Write-Host "Disabling rule '$displayName'"
Disable-SCOMRule -ManagementPack $mpForOverrides -Rule $_
}
else
{
Write-Host "Rule '$displayName' is already disabled"
}
}
}
}
# SIG # Begin signature block
# MIIYyQYJKoZIhvcNAQcCoIIYujCCGLYCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDXrqjg4yOVSwLd
# ujPVftvC3I23XFIdgUMvUr5nIt2+vKCCExAwggQVMIIC/aADAgECAgsEAAAAAAEx
# icZQBDANBgkqhkiG9w0BAQsFADBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3Qg
# Q0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
# bjAeFw0xMTA4MDIxMDAwMDBaFw0yOTAzMjkxMDAwMDBaMFsxCzAJBgNVBAYTAkJF
# MRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iY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