top of page

Offline PowerCLI Configuration

Updated: Jan 11

- Confirm that your PowerShell version is at least 5.x

o Launch PowerShell as admin and run this cmdlet: $PSVersionTable

- Download the VMware PowerCLI modules:

o From an online machine: run this command: Save-Module –Name VMware.PowerCLI –Path C:\windows\users\YOURUSERNAME\downloads\

o Select [Y] when prompted to install the NuGet provider

o The modules will now be downloaded to the local machine

  • Copy the modules to an external media device for later use

o From an offline machine: Copy these modules from a disc, NAS, or an online machine and copy them to C:\windows\system32\WindowsPowerShell\v1.0\Modules

o In the Windows GUI, verify that the modules are located in C:\windows\system32\WindowsPowerShell\v1.0\Modules.

- Confirm that the PowerCLI module has been configured/installed and is available in PowerShell:

o Get-Module –ListAvailable –Name VMwware*

- Set some prerequisites before trying to connect to the vCenter server:

o Set-ExecutionPolicy -ExecutionPolicy unrestricted

  • Select [Y] when asked to confirm the execution policy change.

o Import-Module VMware.VimAutomation.core

o Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

  • Select [Y] when asked to perform operation.

- Connect to the vCenter server :

o connect-viserver IPADDRESS

o Yellow verbose text will be displayed as the connection to vCenter is established:

- You will be prompted to log into vCenter with a Windows security pop up window.

o Login using: domain\username syntax

- You are successfully connected to vCenter once PowerShell displays the vCenter IP address, the user connected, and the port used (443).

- If desired, create a shortcut to automatically connect to your vCenter server so you don’t have to manually connect every time:

o On your Desktop, Right Click and Select new Shortcut:

o In the “Type the location of the item:” section enter the below command

o %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command “connect-viserver IPADDRESS”

- Name the shortcut “PowerCLI vCenter” or any name that you choose. Run this shortcut “as admin” when you use it.

- Below are some common PowerCLI cmdlets that you can use to view the ESXI hosts and VMs:

o get-vicommand:

  • This will list all commands available within PowerCLI modules

o get-vmhost:

  • Displays all ESXi servers

o get-vm

  • Displays all virtual machines

o get-vmhost –name IPADDRESS

  • Displays all vms currently on ESXI host IPADDRESS

4 views0 comments
bottom of page