how to set proxy on invoke-webrequest

Sara 421 Reputation points
2024-06-14T14:10:40.7033333+00:00

can someone help me with how I can pass proxy here in this script and if I am missing any syntax here? Full script in comment section! running into defender.ps1 is not recognized and a invalid err token error

Invoke-WebRequest @parameters

.\defender.ps1 -type dockerWindows -consoleCN us-east1.cloud.twistlock.com -install
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,460 questions
{count} votes

Accepted answer
  1. Rich Matheisen 45,831 Reputation points
    2024-06-14T15:26:01.6766667+00:00

    You can just add Proxy = <ProxyURLGoesHere> to the $parameters hash.

    The "not recognized" error usually just means the file "defender.ps1" wasn't found in the current directory.

    Not sure about the "invalid token" problem without knowing where in the script the error occurs.

    0 comments No comments

0 additional answers

Sort by: Most helpful