Skip to content

Instantly share code, notes, and snippets.

@stephanlinke
Last active December 14, 2017 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephanlinke/2bba2ee7c56f51eefcbf6d093d71218b to your computer and use it in GitHub Desktop.
Save stephanlinke/2bba2ee7c56f51eefcbf6d093d71218b to your computer and use it in GitHub Desktop.
Resume all notifications that are paused
$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