Powershell and Vmware PowerCLI, get-vm exception has been thrown by the target of an invocation. How to fix and add proxy in powershell. Add PSGallery as a repo.#vExpert #VMware #powershell #vmwarepowercli

  1. Uninstall PowerCLI from VMware (we add it later from PSGallery)
  2. Start Powershell
  3. Set tls security to 1.2
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  4. Set http proxy
    [Environment]::SetEnvironmentVariable("HTTP_PROXY", "proxy.invid.se:3128", [EnvironmentVariableTarget]::Machine)
  5. Set https proxy
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", "proxy.invid.se:3128", [EnvironmentVariableTarget]::Machine)

Now that we have internet connection you can try in powershell, just for confirmation.

wget https://invid.se

Now it is time to register PSgallery

Register-PSRepository -Default -Verbose

If you trust Microsoft the set the Gallery to Trusted.

Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted

List your repo


Powershell1Now it is time for VMware Stuff

Get-Module VMware.* -ListAvailable


Install VMware Powercli, I am running linux so I do not think -scope work…

Install-Module -Name VMware.PowerCLI

If you trust your certificates the ignore if it bulitin cert

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

To update your VMware.PowerCLI

Update-Module -Name VMware.PowerCLI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: