Last active
December 14, 2017 09:35
-
-
Save stephanlinke/2bba2ee7c56f51eefcbf6d093d71218b to your computer and use it in GitHub Desktop.
Resume all notifications that are paused
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
$prtgserver=""; | |
$protocol=""; | |
$port=80; | |
$user=""; | |
$passhash=""; | |
$configpath = "C:\ProgramData\Paessler\PRTG Network Monitor\PRTG Configuration.dat"; | |
[xml]$Configuration = (Get-Content $configpath); | |
$Notifications = $Configuration.SelectNodes("//notification[@id]") | |
foreach($notification in $Notifications){ | |
$URL = "{0}://{1}:{2}/api/pause.htm?id={3}&action=1&username={4}&passhash={5}" -f $protocol,$prtgserver,$port,$Notification.id,$user,$passhash; | |
$Response = (Invoke-WebRequest -UseBasicParsing $URL); | |
if($Response.StatusCode -eq 200){ | |
Write-Host ("[{0}] " -f (Get-Date)) -NoNewline; | |
Write-Host "[success] " -ForegroundColor Green -NoNewline; | |
Write-Host ("Notification '{0}' has been resumed successfully" -f $notification.data.name.Trim()) | |
} | |
else { | |
Write-Host ("[{0}] " -f (Get-Date)) -NoNewline; | |
Write-Host "[error] " -ForegroundColor Red -NoNewline; | |
Write-Host ("Something went wrong for '{0}', please check if the URL {1} works in a browser" -f $notification.data.name.Trim(),$URL) | |
} | |
} | |
Write-Host "0:Monitoring notifications..."; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment