New profile/new machine. Quick steps to be able to get up and running without hitting all the errors

Install Power-CLI

Install-Module VMware.PowerCLI -Scope CurrentUser

Link: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.esxi.install.doc/GUID-F02D0C2D-B226-4908-9E5C-2E783D41FE2D.html

Because without it you can’t run PowerCLI cmdlets

Set Execution Policy

Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser

Link: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy

Because by default you can’t run Powershell scripts. Sample Error:

Import-Module : File C:\Program
Files\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\12.0.0.15939651\VMware.VimAutomation.Sdk.psm1 cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
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

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Link: https://www.ivobeerens.nl/2018/07/18/quick-tip-powercli-invalid-server-certificate-error/

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
'vcsa.test.testdev'.

VMware Power-CLI quick setup
Tagged on:

Leave a Reply

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