Workspace-Guru

LWStratusAPI.ps1

Mar 31st, 2019
1,364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $hub = 'HUB-FQDN'
  2. $json = '<JSON QUERY>'
  3.  
  4. ### Trust Certificate
  5. Add-Type @"
  6. using System.Net;
  7. using System.Security.Cryptography.X509Certificates;
  8. public class TrustAllCertsPolicy : ICertificatePolicy {
  9.    public bool CheckValidationResult(
  10.        ServicePoint srvPoint, X509Certificate certificate,
  11.        WebRequest request, int certificateProblem) {
  12.        return true;
  13.    }
  14. }
  15. "@
  16. [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
  17.  
  18. ### Get data
  19. $result = (Invoke-WebRequest -Method GET -Uri https://$hub/lwl/api?json=$json | ConvertFrom-Json).table
  20.  
  21. ### Show data
  22. $result
Advertisement
Add Comment
Please, Sign In to add comment