VMware Cloud Community
higginsj
Contributor
Contributor
Jump to solution

How do I choose to use customized Proxy other than System Proxy

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

Tags (2)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

1 Reply
LucD
Leadership
Leadership
Jump to solution

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference