Closed randomnote1 closed 3 years ago
Select Owner via XPath
Try {
$assignmentRule=$configFile.SelectSingleNode("//config/exceptions/exception[@enabled='true']/Alert[@Name=""$alertName"" and @enabled='true']/parent::*")
}
[assign.alert.config.txt](https://github.com/hmscott4/AlertManagement/files/6394202/assign.alert.config.txt)
Catch [System.Exception] {
$msg=$_.Exception.Message
$msgLevel=1
Write-LogEntry $msg $msgLevel $logLevel $logFile
$warnCounter++
}
if($assignmentRule){
$assignedTo=$assignmentRule.Owner
}
@hmscott4, working on this now as it will be much too hard to do later. Just one question for you regarding Alert Exceptions. I think it makes sense to add the alert properties as separate nodes as opposed to attributes. That way they can be tagged as CDATA
if necessary. Thoughts?
<Alert Name="Failed to perform Application Pool discovery" enabled="true">
<AlertProperty>MonitoringObjectDisplayName</AlertProperty>
<AlertPropertyMatches>rdpcert</AlertPropertyMatches>
</Alert>
Rather than defining each owner and management pack in a separate rule, define a single owner node with multiple management pack nodes. This will make the config file easier to maintain.