Summary
VMware vSphere is the enterprise virtualization platform that most large companies run their infrastructure on. ESXi plus vCenter gives you live VM migration, automatic load balancing, and high availability — features that were genuinely impressive when they launched and still matter in production. It’s expensive, Broadcom has made it more so, but knowing it is still a valuable skill if you’re working in enterprise environments.
Key concepts
- ESXi: Bare-metal hypervisor that runs directly on server hardware
- vCenter Server: Centralized management platform for ESXi hosts
- vMotion: Live migration of running VMs between hosts without downtime
- DRS (Distributed Resource Scheduler): Automatic load balancing across hosts
- HA (High Availability): Automatic VM restart on host failure
- vSAN: Software-defined storage using local disks
- Virtual machines: Isolated compute environments running guest operating systems
Details
Architecture components
Core components:
- ESXi Host: Type 1 hypervisor running on physical hardware
- vCenter Server: Centralized management and orchestration
- vSphere Client: Web-based management interface (HTML5)
- vSphere API: Programmatic access for automation
Storage:
- VMFS: VMware’s clustered file system
- NFS: Network File System datastores
- vSAN: Hyper-converged storage solution
- vVols: Virtual volumes with array integration
Networking:
- Standard Switch (vSS): Per-host virtual networking
- Distributed Switch (vDS): Cluster-wide virtual networking
- NSX: Software-defined networking and security
ESXi host management
Access methods:
- ESXi Host Client:
https://esxi-ip/ui - vCenter Server: Centralized management
- SSH: Enable in Host → Manage → Services → TSM-SSH
- ESXi Shell: Direct console access (DCU)
ESXi CLI commands:
# View ESXi version
vmware -v
# List running VMs
esxcli vm process list
# Restart management agents
services.sh restart
# View network configuration
esxcli network ip interface ipv4 get
esxcli network nic list
# View storage adapters
esxcli storage core adapter list
# View datastores
esxcli storage filesystem list
# View host hardware
esxcli hardware platform get
esxcli hardware memory get
# Maintenance mode
vim-cmd hostsvc/maintenance_mode_enter
vim-cmd hostsvc/maintenance_mode_exit
# Reboot/shutdown host
esxcli system shutdown reboot -r "planned reboot"
esxcli system shutdown poweroff -r "planned shutdown"Virtual machine management
VM operations via CLI:
# List all VMs
vim-cmd vmsvc/getallvms
# Get VM power state
vim-cmd vmsvc/power.getstate <vmid>
# Power on VM
vim-cmd vmsvc/power.on <vmid>
# Power off VM
vim-cmd vmsvc/power.off <vmid>
# Shutdown guest OS
vim-cmd vmsvc/power.shutdown <vmid>
# Reset VM
vim-cmd vmsvc/power.reset <vmid>
# Create snapshot
vim-cmd vmsvc/snapshot.create <vmid> "snapshot-name" "description" 0 0
# List snapshots
vim-cmd vmsvc/snapshot.get <vmid>
# Revert to snapshot
vim-cmd vmsvc/snapshot.revert <vmid> <snapshotid>
# Delete snapshot
vim-cmd vmsvc/snapshot.remove <vmid> <snapshotid>
# Reload VM configuration
vim-cmd vmsvc/reload <vmid>
# Unregister VM
vim-cmd vmsvc/unregister <vmid>
# Register VM
vim-cmd solo/registervm /vmfs/volumes/datastore/vm/vm.vmxVM file locations:
# VM files on datastore
cd /vmfs/volumes/datastore-name/vm-name/
# Key files:
# vmname.vmx - VM configuration file
# vmname.vmdk - Virtual disk descriptor
# vmname-flat.vmdk - Virtual disk data
# vmname.nvram - BIOS/EFI settings
# vmname.vmsd - Snapshot metadata
# vmname.log - VM log filesPowerCLI (PowerShell automation)
Installation:
# Install PowerCLI module
Install-Module -Name VMware.PowerCLI -Scope CurrentUser
# Import module
Import-Module VMware.PowerCLI
# Set PowerCLI configuration
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$falseCommon PowerCLI commands:
# Connect to vCenter
Connect-VIServer -Server vcenter.domain.com -User administrator@vsphere.local
# Get all VMs
Get-VM
# Get VM details
Get-VM -Name "vm-name" | Select-Object Name, PowerState, NumCpu, MemoryGB
# Power operations
Start-VM -VM "vm-name"
Stop-VM -VM "vm-name" -Confirm:$false
Restart-VM -VM "vm-name" -Confirm:$false
Shutdown-VMGuest -VM "vm-name" -Confirm:$false
# Snapshot operations
New-Snapshot -VM "vm-name" -Name "snapshot-name" -Description "description"
Get-Snapshot -VM "vm-name"
Set-VM -VM "vm-name" -Snapshot "snapshot-name" -Confirm:$false
Remove-Snapshot -Snapshot "snapshot-name" -Confirm:$false
# Clone VM
New-VM -Name "new-vm" -VM "template-vm" -VMHost "esxi-host" -Datastore "datastore"
# Move VM between hosts (vMotion)
Move-VM -VM "vm-name" -Destination "target-host"
# Storage vMotion
Move-VM -VM "vm-name" -Datastore "target-datastore"
# Get cluster information
Get-Cluster
Get-Cluster -Name "cluster-name" | Get-VM
# DRS configuration
Get-Cluster "cluster-name" | Set-Cluster -DrsEnabled $true -DrsAutomationLevel FullyAutomated
# Get host information
Get-VMHost
Get-VMHost | Select-Object Name, ConnectionState, PowerState, Version
# Datastore information
Get-Datastore
Get-Datastore | Select-Object Name, CapacityGB, FreeSpaceGB
# Network information
Get-VirtualSwitch
Get-VirtualPortGroup
Get-VMHostNetworkAdapter
# Disconnect from vCenter
Disconnect-VIServer -Confirm:$falsevCenter Server management
vCenter services:
# Service control (VCSA)
service-control --status --all
service-control --stop --all
service-control --start --all
service-control --restart vmware-vpxd
# Backup vCenter
/usr/lib/vmware-vmon/vmon-cli --backup /tmp/backup.tar.gz
# Check vCenter database
/opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB -c "SELECT version();"vCenter Server Appliance (VCSA) shell:
# Access via SSH or DCUI
# Default shell: appliancesh
# Exit to bash
shell.set --enabled true
shell
# Disk usage
df -h
# View logs
tail -f /var/log/vmware/vpxd/vpxd.logStorage management
Datastore operations:
# List datastores
esxcli storage filesystem list
# Rescan storage adapters
esxcli storage core adapter rescan --all
# Create VMFS datastore
esxcli storage filesystem automount
# Extend datastore
esxcli storage vmfs extent add -p /vmfs/devices/disks/naa.xxx -v datastore-name
# Mount NFS datastore
esxcli storage nfs add --host nfs-server --share /export/path --volume-name nfs-datastorevSAN commands:
# vSAN cluster status
esxcli vsan cluster get
# vSAN disk status
esxcli vsan storage list
# Resync objects
esxcli vsan policy setpolicy --uuid <uuid>Networking
Network configuration:
# List virtual switches
esxcli network vswitch standard list
# Add port group
esxcli network vswitch standard portgroup add --portgroup-name=vlan20 --vswitch-name=vSwitch0
# Set VLAN
esxcli network vswitch standard portgroup set --portgroup-name=vlan20 --vlan-id=20
# List VMkernel adapters
esxcli network ip interface ipv4 get
# Add VMkernel interface
esxcli network ip interface add --interface-name=vmk1 --portgroup-name=vMotion
# Set IP address
esxcli network ip interface ipv4 set --interface-name=vmk1 --ipv4=192.168.1.10 --netmask=255.255.255.0 --type=static
# Enable vMotion on VMkernel
vim-cmd hostsvc/vmotion/vnic_set vmk1High Availability (HA)
HA cluster configuration:
- Minimum 2 ESXi hosts required
- Shared storage (VMFS, NFS, vSAN)
- Network redundancy recommended
- Configure via vCenter: Cluster → Configure → vSphere HA
HA features:
- VM restart on host failure
- Host monitoring and isolation response
- VM monitoring (application-level)
- Admission control for failover capacity
DRS (Distributed Resource Scheduler)
DRS automation levels:
- Manual: User approves all recommendations
- Partially Automated: User approves VM placement
- Fully Automated: Automatic VM placement and migration
DRS rules:
- VM-VM affinity: Keep VMs together
- VM-VM anti-affinity: Keep VMs separated
- VM-Host affinity: Bind VMs to specific hosts
- VM-Host anti-affinity: Keep VMs off specific hosts
Performance monitoring
esxtop command:
# Interactive performance monitor
esxtop
# Key sections:
# c - CPU
# m - Memory
# d - Disk
# n - Network
# v - Virtual machine
# Batch mode for logging
esxtop -b -n 60 > esxtop.logPerformance metrics:
# CPU usage
esxcli hardware cpu global get
# Memory usage
esxcli hardware memory get
# VM statistics
vim-cmd vmsvc/get.summary <vmid>Examples
Bulk VM power operations:
# PowerCLI: Power off all VMs in folder
Get-Folder "Test-VMs" | Get-VM | Stop-VM -Confirm:$false
# Start VMs with specific tag
Get-VM -Tag "Production" | Start-VMCreate multiple VMs from template:
1..10 | ForEach-Object {
New-VM -Name "web-server-$_" -Template "ubuntu-template" `
-VMHost "esxi-01" -Datastore "datastore1" `
-ResourcePool "Web-Servers"
}Export VM list to CSV:
Get-VM | Select-Object Name, PowerState, NumCpu, MemoryGB, UsedSpaceGB, Notes |
Export-Csv -Path "vm-inventory.csv" -NoTypeInformationAutomated snapshot cleanup:
# Remove snapshots older than 7 days
$oldDate = (Get-Date).AddDays(-7)
Get-VM | Get-Snapshot | Where-Object {$_.Created -lt $oldDate} |
Remove-Snapshot -Confirm:$falseHealth check script:
# ESXi host health check
Get-VMHost | Select-Object Name, ConnectionState, PowerState, Version, Build |
Format-Table -AutoSize
# Check datastore space
Get-Datastore | Where-Object {$_.FreeSpaceGB -lt 100} |
Select-Object Name, CapacityGB, FreeSpaceGBPowerCLI is the part most people skip, but it’s how you actually manage vSphere at scale — learn it if you’re dealing with more than a handful of VMs.
Resources
- VMware vSphere Documentation
- VMware PowerCLI Documentation
- VMware KB (Knowledge Base)
- VMware Compatibility Guide
- VMware Hands-on Labs
- vExpert Community
- VMTN (VMware Technology Network)