-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-IntervalDiscoveries.ps1
31 lines (26 loc) · 1.19 KB
/
Get-IntervalDiscoveries.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Script gets all discoveries with an specific interal.
# Patrick Seidl, s2 - seidl solutions
$table = @()
Foreach ($discovery in (get-scomdiscovery | foreach-object {$_.DataSource})) {
if ($discovery.Configuration -match "<IntervalSeconds>(?<content>.*)</IntervalSeconds>") {
$intervalSeconds = [int]$matches['content']
if ($intervalSeconds -le 3600) {
Write-Host $intervalSeconds -ForegroundColor Red
} elseif ($intervalSeconds -gt 3600 -and $intervalSeconds -le 43200) {
Write-Host $intervalSeconds -ForegroundColor Yellow
} elseif ($intervalSeconds -gt 43200) {
Write-Host $intervalSeconds -ForegroundColor Green
}
Write-Host "Workflow:" $discovery.get_ParentElement().DisplayName
Write-Host "MP:" ($discovery.GetManagementPack()).DisplayName
$hash = @{
ManagementPack = $discovery.GetManagementPack().DisplayName
Interval = $intervalSeconds
DiscoveryWorkflow = $discovery.get_ParentElement().DisplayName
}
$object = New-Object psobject -Property $hash
$table += $object
"-"*30
}
}
$table | Out-GridView