I have had a look at the page below and have been able to generate reports and list sensors however what I really want to do is modify sensor settings.
https://kb.paessler.com/en/topic/68506-powershell-interface-for-prtg-api
Is it possible to do something like:
######ignore invalid SSL Certs########## add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy ######setup details, access related. $auth = "username=user&passhash=hash" $PRTGHost = "IPADDRESS" function Set-prtgSensorProperty ([string]$SensorID,[string]$PropertyName,[string]$Value) { $url = "https://$PRTGHost/api/setobjectproperty.htm?id=$SensorID&name=$PropertyName&value=$Value&$auth" $request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore } # end function
Obviously I tried that and it didn't work but is there an alternative? Am I missing something?
Add comment