Automation

 View Only
  • 1.  How do I choose to use customized Proxy other than System Proxy

    Posted Jun 30, 2017 06:07 AM

    Hi all,

        My current environment requires a proxy (for cli) or jump box (for gui) to connect the vcenter. 

        However, I have checked docs that Set-PowerCLIConfiguration - vSphere PowerCLI Cmdlets Reference only provides options for System Proxy. In this particular case,I do not want use System Proxy and want to use customized proxy. How can I achieve this use case ?

       Any help will be appreciated.

    Thanks



  • 2.  RE: How do I choose to use customized Proxy other than System Proxy
    Best Answer

    Posted Jun 30, 2017 06:38 AM

    Can't you set the system proxy to that specific proxy?

    And then use Set-PowerCLIConfiguration with ProxyPolicy to set it to UseSystemPolicy.

    To set the proxy you could try

    [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy('http://my-proxy:8080')

    And if credentials are required

    $webclient=New-Object System.Net.WebClient

    $creds=Get-Credential -Message "Enter proxy credentials"

    $webclient.Proxy.Credentials=$creds

    And to start using the proxy for the PowerCLI cmdlet

    Set-PowerCLIConfiguration -ProxyPolicy UseSystemProxy