I have the below script to install a defender software on my development server and when I run it I run into a error where “defender.ps1 is not recognized and err : invalid token”I feel like it needs proxy passed in the script to reach the internet, can someone help me with how I can pass proxy here in this script and if I am missing any syntax here?
$parameters = @{ Uri = "https://us-east1.cloud.twistlock.com/us-2-158262581/api/v1/scripts/defender.ps1";
Method = "Post"; Headers = @{"authorization" = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWJyYW5kYW5vQGF0aGVuvyJePoU" }; OutFile = "defender.ps1"; ; }; if ($PSEdition -eq 'Desktop') { 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; } else { $parameters.SkipCertificateCheck = $true; } [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-WebRequest @parameters; .defender.ps1 -type dockerWindows -consoleCN us-east1.cloud.twistlock.com -install
Invoke-WebRequest @parameters; .defender.ps1 -type dockerWindows -consoleCN us-east1.cloud.twistlock.com -install -proxy http://outproxy-dev.com:3128