Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $prtgserver="";
- $protocol="";
- $port=80;
- $user="prtgadmin";
- $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)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement