Qué vas a conseguir
Operar un clúster de vSphere en el día a día sin pasar por el asistente cada vez: una VM nueva desde plantilla en dos minutos, snapshots que no se olvidan, y la rutina para sacar un host del clúster, parchearlo y devolverlo con las máquinas moviéndose solas. Y los tres sitios donde mirar cuando "todo va lento".
Antes de empezar
- Acceso a vCenter con un rol que pueda crear VMs, snapshots y poner hosts en mantenimiento (no
Administrator@vsphere.localpara el día a día: un rol propio con lo justo, asignado a tu grupo de AD). - PowerCLI instalado en tu equipo:
Install-Module VMware.PowerCLI -Scope CurrentUser. - Una plantilla de Windows Server y otra de Linux ya preparadas, con una especificación de personalización (nombre, red, unión al dominio).
- Un clúster con DRS y HA activados y al menos dos hosts con almacenamiento compartido; sin eso, vMotion no tiene adónde ir.
1. Conectar con PowerCLI y mirar el clúster
Connect-VIServer -Server vcenter.contoso.localName Port User---- ---- ----vcenter.contoso.local 443 CONTOSO\laura.pradoGet-Cluster | Select-Object Name, HAEnabled, DrsEnabled, DrsAutomationLevelName HAEnabled DrsEnabled DrsAutomationLevel---- --------- ---------- ------------------CL-PROD True True FullyAutomatedGet-VMHost | Select-Object Name, ConnectionState, @{n="CPU%";e={[int]($_.CpuUsageMhz/$_.CpuTotalMhz*100)}}, @{n="Mem%";e={[int]($_.MemoryUsageGB/$_.MemoryTotalGB*100)}}, Version, BuildName ConnectionState CPU% Mem% Version Build---- --------------- ---- ---- ------- -----esx01.contoso.local Connected 41 68 8.0.3 24022510esx02.contoso.local Connected 38 71 8.0.3 24022510esx03.contoso.local Connected 44 66 8.0.3 24022510Get-Datastore | Select-Object Name, @{n="FreeGB";e={[int]$_.FreeSpaceGB}}, @{n="Free%";e={[int]($_.FreeSpaceGB/$_.CapacityGB*100)}}Name FreeGB Free%---- ------ -----DS-SAN-01 1840 31DS-SAN-02 212 4Tres comandos y ya sabes si hay sitio para una VM más (memoria al 70 % con tres hosts significa que si uno cae, los otros dos van al 100 %) y que DS-SAN-02 está a punto de dar problemas. Esa lectura es la que se hace antes de aceptar cualquier petición de "una VM pequeña".
2. Crear la VM desde plantilla
New-VM -Name "srv-app-02" -Template (Get-Template "tpl-ws2025-core") -OSCustomizationSpec "spec-windows-domain" -ResourcePool (Get-Cluster CL-PROD) -Datastore DS-SAN-01 -Location (Get-Folder "Aplicaciones") | Out-NullSet-VM -VM srv-app-02 -NumCpu 4 -MemoryGB 8 -Notes "Ticket CHG-20471 · Owner: IT Ops · App: Intranet" -Confirm:$false | Out-NullGet-NetworkAdapter -VM srv-app-02 | Set-NetworkAdapter -NetworkName "VLAN20-Servers" -Type Vmxnet3 -Confirm:$false | Out-NullNew-TagAssignment -Entity (Get-VM srv-app-02) -Tag (Get-Tag -Category Backup -Name "Daily-30d") | Out-NullStart-VM -VM srv-app-02 | Out-Null; Get-VM srv-app-02 | Select-Object Name, PowerState, NumCpu, MemoryGB, @{n="Host";e={$_.VMHost.Name}}, @{n="IP";e={$_.Guest.IPAddress[0]}}Name PowerState NumCpu MemoryGB Host IP---- ---------- ------ -------- ---- --srv-app-02 PoweredOn 4 8 esx02.contoso.local 10.20.20.47Dos cosas que no son opcionales en una VM de producción: las notas con el ticket y el propietario (dentro de un año nadie recordará para qué era) y la etiqueta de backup, que es lo que Veeam (Nivel 2) usa para incluirla en el job sin que nadie la añada a mano. La especificación de personalización se encarga del nombre, la IP y la unión al dominio; a los cinco minutos la VM aparece en Active Directory.
3. Snapshots: cortos, con nombre y con fecha
New-Snapshot -VM srv-app-02 -Name "CHG-20471 antes de parche · borrar 2026-10-25" -Description "laura.prado · parche de la aplicación" -Memory:$false -Quiesce:$true | Out-NullGet-VM | Get-Snapshot | Where-Object Created -lt (Get-Date).AddDays(-3) | Select-Object VM, Name, Created, @{n="SizeGB";e={[math]::Round($_.SizeGB,1)}}VM Name Created SizeGB-- ---- ------- ------srv-erp-01 antes de actualizar 2026-09-02 21:14 184,3srv-file-02 prueba 2026-08-19 10:02 61,0# cuando el cambio esté validado:Get-Snapshot -VM srv-app-02 | Remove-Snapshot -Confirm:$falseUn snapshot de 184 GB de hace siete semanas en el servidor del ERP es la causa número uno de "el ERP va lento" y de datastores llenos. La regla: nombre con el ticket y la fecha de borrado, nunca más de 72 horas, -Quiesce para que sea consistente con la aplicación, sin memoria salvo que necesites volver al estado exacto de ejecución. El comando de la segunda línea, en una tarea semanal que mande el resultado al canal del equipo, es la política de snapshots. Un snapshot no es una copia de seguridad: si el datastore se pierde, se pierde con él.
4. Un host en mantenimiento sin cortar nada
Get-VMHost esx03.contoso.local | Get-VM | Select-Object Name, PowerState | Measure-Object | Select-Object CountCount----- 14Set-VMHost -VMHost esx03.contoso.local -State Maintenance -Evacuate -Confirm:$false# DRS mueve las 14 VMs con vMotion a esx01 y esx02; tarda unos minutosGet-VMHost esx03.contoso.local | Select-Object Name, ConnectionState, @{n="VMs";e={($_ | Get-VM).Count}}Name ConnectionState VMs---- --------------- ---esx03.contoso.local Maintenance 0# parchear con Lifecycle Manager (o desde la consola: Updates › Remediate) y reiniciarRestart-VMHost -VMHost esx03.contoso.local -Confirm:$false | Out-NullSet-VMHost -VMHost esx03.contoso.local -State Connected | Out-NullGet-VMHost | Select-Object Name, ConnectionState, Version, BuildEsto es lo que hace que parchear un hipervisor no sea un cambio con corte: modo de mantenimiento con evacuación, DRS reparte las VMs, se parchea, se reinicia, se devuelve, y DRS vuelve a equilibrar. Compruébalo antes con la pregunta del paso 1: si los otros dos hosts no tienen memoria para absorber las 14 VMs, el Set-VMHost se queda esperando. En vCenter, Lifecycle Manager con una imagen por clúster hace la parte del parche y deja el informe de cumplimiento.
Consejo: haz esto en un host de test o con una VM de pruebas la primera vez, y mira en Monitor → Tasks and Events cómo se mueve cada VM. Lo que ves ahí es lo que explicas en el ticket de cambio.
5. Datastore lleno y "todo va lento"
Get-Datastore DS-SAN-02 | Get-VM | Get-Snapshot | Measure-Object SizeGB -Sum | Select-Object @{n="SnapshotGB";e={[int]$_.Sum}}SnapshotGB---------- 412Get-Datastore DS-SAN-02 | Get-VM | Where-Object {$_.PowerState -eq "PoweredOff"} | Select-Object Name, @{n="ProvisionedGB";e={[int]$_.ProvisionedSpaceGB}}Name ProvisionedGB---- -------------srv-old-crm 520Get-VM srv-erp-01 | Get-Stat -Stat disk.maxTotalLatency.latest -Realtime -MaxSamples 10 | Select-Object Timestamp, ValueTimestamp Value--------- -----22/10/2026 10:12:00 4822/10/2026 10:11:40 61Los tres sitios donde mirar: snapshots en el datastore (412 GB aquí, el 90 % del problema), VMs apagadas que nadie borró (520 GB provisionados) y la latencia de disco de la VM que se queja (disk.maxTotalLatency por encima de 20-30 ms sostenidos es almacenamiento, no la VM). En la consola, Monitor → Performance → Advanced muestra lo mismo con gráfico; esxtop en el host, con d y u, es la vista fina. Con Grafana (guía anterior), vmware_exporter o el plugin de vCenter dan estas métricas en el panel del equipo.
6. Lo que revisas cada mes
- Snapshots con más de 3 días y VMs apagadas con más de 30 (
Get-VM | Where PowerState -eq PoweredOff | Select Name, @{n="Days";e={((Get-Date)-($_ | Get-VIEvent -MaxSamples 1).CreatedTime).Days}}). - Datastores por debajo del 15 % libre y el crecimiento mensual.
- Hosts con builds distintos en el mismo clúster (
Get-VMHost | Group-Object Build): el que no se parcheó. - Skyline Health /
Monitor → Healthdel clúster y las alarmas de vCenter no reconocidas. - Que vCenter tiene su propia copia (
File-Based Backupen la VAMI, puerto 5480) y que se probó una restauración este trimestre.
Siguientes pasos
- VCF / NSX cuando el clúster crezca a varios y la red pase a definirse por software; la operación diaria es la misma, con más capas.
- vSphere Replication o SRM para el DR del Nivel 4: la VM replicada en el otro CPD y el plan de recuperación probado dos veces al año.
- Para quien venga de Hyper-V (guía anterior) o vaya a Nutanix (Nivel 4): snapshots cortos, host en mantenimiento, datastore con margen y notas en la VM son las mismas reglas con otros nombres.
¿Falta algo o en tu entorno es distinto? Escríbeme y lo corrijo.
What you'll get
Operate a vSphere cluster day to day without the wizard every time: a new VM from a template in two minutes, snapshots that don't get forgotten, and the routine to take a host out of the cluster, patch it and bring it back with the machines moving by themselves. Plus the three places to look when "everything is slow".
Before you start
- Access to vCenter with a role that can create VMs, snapshots and put hosts in maintenance (not
Administrator@vsphere.localfor daily work: a custom role with just enough, assigned to your AD group). - PowerCLI installed on your machine:
Install-Module VMware.PowerCLI -Scope CurrentUser. - A Windows Server template and a Linux one already prepared, with a customization specification (name, network, domain join).
- A cluster with DRS and HA enabled and at least two hosts on shared storage; without that, vMotion has nowhere to go.
1. Connect with PowerCLI and look at the cluster
Connect-VIServer -Server vcenter.contoso.localName Port User---- ---- ----vcenter.contoso.local 443 CONTOSO\laura.pradoGet-Cluster | Select-Object Name, HAEnabled, DrsEnabled, DrsAutomationLevelName HAEnabled DrsEnabled DrsAutomationLevel---- --------- ---------- ------------------CL-PROD True True FullyAutomatedGet-VMHost | Select-Object Name, ConnectionState, @{n="CPU%";e={[int]($_.CpuUsageMhz/$_.CpuTotalMhz*100)}}, @{n="Mem%";e={[int]($_.MemoryUsageGB/$_.MemoryTotalGB*100)}}, Version, BuildName ConnectionState CPU% Mem% Version Build---- --------------- ---- ---- ------- -----esx01.contoso.local Connected 41 68 8.0.3 24022510esx02.contoso.local Connected 38 71 8.0.3 24022510esx03.contoso.local Connected 44 66 8.0.3 24022510Get-Datastore | Select-Object Name, @{n="FreeGB";e={[int]$_.FreeSpaceGB}}, @{n="Free%";e={[int]($_.FreeSpaceGB/$_.CapacityGB*100)}}Name FreeGB Free%---- ------ -----DS-SAN-01 1840 31DS-SAN-02 212 4Three commands and you already know whether there is room for one more VM (memory at 70% with three hosts means that if one fails, the other two go to 100%) and that DS-SAN-02 is about to cause trouble. That reading is what you do before accepting any request for "a small VM".
2. Create the VM from a template
New-VM -Name "srv-app-02" -Template (Get-Template "tpl-ws2025-core") -OSCustomizationSpec "spec-windows-domain" -ResourcePool (Get-Cluster CL-PROD) -Datastore DS-SAN-01 -Location (Get-Folder "Applications") | Out-NullSet-VM -VM srv-app-02 -NumCpu 4 -MemoryGB 8 -Notes "Ticket CHG-20471 · Owner: IT Ops · App: Intranet" -Confirm:$false | Out-NullGet-NetworkAdapter -VM srv-app-02 | Set-NetworkAdapter -NetworkName "VLAN20-Servers" -Type Vmxnet3 -Confirm:$false | Out-NullNew-TagAssignment -Entity (Get-VM srv-app-02) -Tag (Get-Tag -Category Backup -Name "Daily-30d") | Out-NullStart-VM -VM srv-app-02 | Out-Null; Get-VM srv-app-02 | Select-Object Name, PowerState, NumCpu, MemoryGB, @{n="Host";e={$_.VMHost.Name}}, @{n="IP";e={$_.Guest.IPAddress[0]}}Name PowerState NumCpu MemoryGB Host IP---- ---------- ------ -------- ---- --srv-app-02 PoweredOn 4 8 esx02.contoso.local 10.20.20.47Two things that are not optional on a production VM: the notes with the ticket and the owner (in a year nobody will remember what it was for) and the backup tag, which is what Veeam (Level 2) uses to include it in the job without anyone adding it by hand. The customization specification takes care of the name, the IP and the domain join; five minutes later the VM appears in Active Directory.
3. Snapshots: short, named and dated
New-Snapshot -VM srv-app-02 -Name "CHG-20471 before patch · delete 2026-10-25" -Description "laura.prado · application patch" -Memory:$false -Quiesce:$true | Out-NullGet-VM | Get-Snapshot | Where-Object Created -lt (Get-Date).AddDays(-3) | Select-Object VM, Name, Created, @{n="SizeGB";e={[math]::Round($_.SizeGB,1)}}VM Name Created SizeGB-- ---- ------- ------srv-erp-01 before upgrade 2026-09-02 21:14 184.3srv-file-02 test 2026-08-19 10:02 61.0# once the change is validated:Get-Snapshot -VM srv-app-02 | Remove-Snapshot -Confirm:$falseA 184 GB snapshot from seven weeks ago on the ERP server is the number one cause of "the ERP is slow" and of full datastores. The rule: name with the ticket and the deletion date, never more than 72 hours, -Quiesce so it is application-consistent, no memory unless you need to return to the exact running state. The second command, in a weekly task that posts the result to the team channel, is the snapshot policy. A snapshot is not a backup: if the datastore is lost, it goes with it.
4. A host in maintenance without cutting anything
Get-VMHost esx03.contoso.local | Get-VM | Select-Object Name, PowerState | Measure-Object | Select-Object CountCount----- 14Set-VMHost -VMHost esx03.contoso.local -State Maintenance -Evacuate -Confirm:$false# DRS moves the 14 VMs with vMotion to esx01 and esx02; takes a few minutesGet-VMHost esx03.contoso.local | Select-Object Name, ConnectionState, @{n="VMs";e={($_ | Get-VM).Count}}Name ConnectionState VMs---- --------------- ---esx03.contoso.local Maintenance 0# patch with Lifecycle Manager (or from the console: Updates › Remediate) and rebootRestart-VMHost -VMHost esx03.contoso.local -Confirm:$false | Out-NullSet-VMHost -VMHost esx03.contoso.local -State Connected | Out-NullGet-VMHost | Select-Object Name, ConnectionState, Version, BuildThis is what makes patching a hypervisor a change without an outage: maintenance mode with evacuation, DRS spreads the VMs, patch, reboot, bring it back, and DRS rebalances. Check beforehand with the question from step 1: if the other two hosts lack the memory to absorb the 14 VMs, the Set-VMHost just waits. In vCenter, Lifecycle Manager with one image per cluster does the patching part and leaves the compliance report.
Tip: do this on a test host or with a test VM the first time, and watch in Monitor → Tasks and Events how each VM moves. What you see there is what you explain in the change ticket.
5. Full datastore and "everything is slow"
Get-Datastore DS-SAN-02 | Get-VM | Get-Snapshot | Measure-Object SizeGB -Sum | Select-Object @{n="SnapshotGB";e={[int]$_.Sum}}SnapshotGB---------- 412Get-Datastore DS-SAN-02 | Get-VM | Where-Object {$_.PowerState -eq "PoweredOff"} | Select-Object Name, @{n="ProvisionedGB";e={[int]$_.ProvisionedSpaceGB}}Name ProvisionedGB---- -------------srv-old-crm 520Get-VM srv-erp-01 | Get-Stat -Stat disk.maxTotalLatency.latest -Realtime -MaxSamples 10 | Select-Object Timestamp, ValueTimestamp Value--------- -----22/10/2026 10:12:00 4822/10/2026 10:11:40 61The three places to look: snapshots on the datastore (412 GB here, 90% of the problem), powered-off VMs nobody deleted (520 GB provisioned) and the disk latency of the VM that complains (disk.maxTotalLatency sustained above 20-30 ms is storage, not the VM). In the console, Monitor → Performance → Advanced shows the same with a chart; esxtop on the host, with d and u, is the fine-grained view. With Grafana (previous guide), vmware_exporter or the vCenter plugin put these metrics on the team board.
6. What you review each month
- Snapshots older than 3 days and VMs powered off for more than 30 (
Get-VM | Where PowerState -eq PoweredOff | Select Name, @{n="Days";e={((Get-Date)-($_ | Get-VIEvent -MaxSamples 1).CreatedTime).Days}}). - Datastores below 15% free and the monthly growth.
- Hosts with different builds in the same cluster (
Get-VMHost | Group-Object Build): the one that didn't get patched. - Skyline Health / the cluster's
Monitor → Healthand unacknowledged vCenter alarms. - That vCenter has its own backup (
File-Based Backupin the VAMI, port 5480) and that a restore was tested this quarter.
Next steps
- VCF / NSX when the cluster grows into several and the network becomes software-defined; the daily operation is the same, with more layers.
- vSphere Replication or SRM for Level 4 DR: the VM replicated in the other data centre and the recovery plan tested twice a year.
- For those coming from Hyper-V (previous guide) or going to Nutanix (Level 4): short snapshots, host in maintenance, datastore headroom and notes on the VM are the same rules with other names.
Is something missing, or different in your environment? Get in touch and I'll fix it.
Tech Career Lab · newsletter
¿Te ha servido? Cada dos semanas envío una idea práctica para perfiles IT: LinkedIn, proyectos, networking y procesos de selección.Found this useful? Every two weeks I send one practical idea for IT professionals: LinkedIn, projects, networking and hiring processes.
Apúntate y llévate las 33 ideasSign up and get the 33 ideas →