New profile/new machine. Quick steps to be able to get up and running without hitting all the errors
Install-Module VMware.PowerCLI -Scope CurrentUser
Because without it you can’t run PowerCLI cmdlets
Set Execution Policy
Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser
Because by default you can’t run Powershell scripts. Sample Error:
Import-Module : File C:\Program
Files\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\22.214.171.12439651\VMware.VimAutomation.Sdk.psm1 cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
At line:1 char:1Import-Module VMWare.VimAutomation.Core
Turn off participation in VMware CEIP
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false
Because the warning is annoying:
WARNING: Please consider joining the VMware Customer Experience Improvement Program, so you can help us make PowerCLI a
better product. You can join using the following command:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true
VMware's Customer Experience Improvement Program ("CEIP") provides VMware with information that enables VMware to
improve its products and services, to fix problems, and to advise you on how best to deploy and use our products. As
part of the CEIP, VMware collects technical information about your organization’s use of VMware products and services
on a regular basis in association with your organization’s VMware license key(s). This information does not personally
identify any individual.
For more details: type "help about_ceip" to see the related help article.
To disable this warning and set your preference use the following command and restart PowerShell:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true or $false.
Allow untrusted certificates
Because no one has fully signed certs in their labs. Self signed are fine. Error:
Connect-VIServer : 11/03/2022 8:23:49 am Connect-VIServer Error: Invalid server certificate. Use
Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect
once or to add a permanent exception for this server.
Additional Information: Could not establish trust relationship for the SSL/TLS secure channel with authority