Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

PowerCLI

Direct answer

PowerCLI is VMware's PowerShell module for vSphere and related products. Connect-VIServer then cmdlets like Get-VM, New-VM and Set-VM automate almost any vCenter task.

When to use this

Use this when automating vCenter tasks with VMware PowerCLI.

First 30 seconds

1. PowerCLI: PowerShell modules for vSphere.

2. Set InvalidCertificateAction to Fail in production with trusted certs.

3. Use -WhatIf.

4. Filter server-side (Get-View) for speed.

5. Disconnect sessions.

Operational verification

PowerCLI → vCenter → objects

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
VMware vSphere / PowerCLI automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformVMware vSphere / PowerCLI automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when automating vCenter tasks with VMware PowerCLI.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

The negative fixture should deliberately exercise risks such as duplicate names, stale inventory, task still running after client timeout, vCenter/host permission gaps, storage/network dependency failure and assuming task success shows guest service health, choosing the cases most relevant to module/version and vCenter context, object MoRef/UUID identity, task completion and independent vSphere/guest read-back.

Step 2 Common mistakes Narrow the fault
  • Not disconnecting sessions (Disconnect-VIServer).
Step 3 Where it fails Narrow the fault

Failure analysis for VMware Automation → PowerCLI should follow the path through the components: PowerCLI/API → vCenter inventory/authorization → task → ESXi/storage/network subsystem → managed object state → independent query.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • PowerCLI is VMware's PowerShell module.
  • Connect-VIServer starts a session.
  • Set InvalidCertificateAction for self-signed certs.
Key checks
  • Connect-VIServer <vc> — connect
  • Get-VM | select Name,PowerState,NumCpu,MemoryGB — inventory
  • Get-PowerCLIConfiguration — settings (InvalidCertificateAction)
ReferenceWhy it matters1 section · depth on demand

In depth

PowerCLI is VMware's PowerShell module collection for vSphere, vSAN, NSX and other VMware products. It is the most common way to script vCenter: reporting, provisioning, configuration changes and bulk operations.

Install-Module VCF.PowerCLI -Scope CurrentUser     # older releases: VMware.PowerCLI
Connect-VIServer vcenter.example.com -Credential (Get-Secret vcenter-automation)
Get-VM | Where-Object PowerState -eq 'PoweredOn' |
  Select-Object Name, NumCpu, MemoryGB, @{n='Host';e={$_.VMHost.Name}} |
  Export-Csv vm-report.csv -NoTypeInformation
Get-VMHost | Get-VMHostService | Where-Object Key -eq 'TSM-SSH' | Select-Object VMHost, Running

Use -WhatIf before bulk changes, filter server-side with Get-View -Filter for large inventories, and set the certificate policy properly instead of ignoring invalid certificates in production.

ReferenceImportant terms & boundaries1 section · depth on demand

Mechanics

VMware Automation → PowerCLI is owned at runtime by vCenter/ESXi control plane invoked through vSphere APIs or PowerCLI. Follow the chain of components PowerCLI/API → vCenter inventory/authorization → task → ESXi/storage/network subsystem → managed object state → independent query and record which layer currently owns truth. The linked authority for bounded mechanics is Broadcom Developer Portal — VMware PowerCLI; documentation support is separate from observed lab/production Evidence.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docVMware vSphere / PowerCLI automation current

Authoritative/upstream documentation reviewed for bounded claims in VMware Automation > PowerCLI. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://developer.broadcom.com/powercli · confidence 94%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

Capture at minimum vCenter, object name+MoRef/UUID, task ID/state, host/datastore/network IDs, PowerCLI/API version, errors and final object/guest state. For module/version and vCenter context, object MoRef/UUID identity, task completion and independent vSphere/guest read-back, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?