Convert Wget call to PowerShell
<p>I am trying to convert a wget invoke call by using the Invoke-WebRequest cmdlet, but the code i tried leads to an issue.</p>

<pre><code>wget --no-check-certificate -S -q --header "Accept: application/json" --header='ContentType: application/json' --header="Authorization: Bearer &lt;TOKEN&gt;" -O https://10.107.174.117/itfm-cloud/rest/reports-api/export-csv?name=servers
</code></pre>

<p>This is what i tried with Invoke-WebRequest, but leads to an error.</p>

<pre><code>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

[System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3")


$username = "ebc\cloudadmin"
$password = "are1!" | ConvertTo-SecureString -asPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($username,$password)


Invoke-WebRequest https://10.107.174.117/itfm-cloud/rest/reports-api/export-csv?name=servers -Credential $cred
</code></pre>

<p><a href="https://i.stack.imgur.com/uLoPI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uLoPI.png" alt="enter image description here"></a></p>

<p>Can anyone help ?</p>