Import A WMWare.PowerCLI from Behind the Proxy

VMWare PowerCLI is a must for Administrators. Here’s a quick script to install it. If I have time, I’ll add more details on the usefulness of this tool.

$proxy="http://proxy:80"

# Set winhttp proxy
$proxy = [System.Net.WebProxy]::GetDefaultProxy().Address
[system.net.webrequest]::defaultwebproxy = New-Object system.net.webproxy($proxy)
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
#$PSDefaultParameterValues = @{ "*:Proxy"="$proxy" }

Import-PackageProvider NuGet -Force
Install-PackageProvider NuGet -Force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module -Name VMware.PowerCLI -AllowClobber -Force

Leave a Reply

Your email address will not be published. Required fields are marked *