Created
May 17, 2016 12:48
-
-
Save vmwarecode/d182392a646418115273394e90e95e5b to your computer and use it in GitHub Desktop.
Remove all ESXi hosts from vCenter and readd them again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #PowerCLI ****Remove all ESXi hosts from vCenter and readd them again.**** | |
| vSphere PowerCLI> $esx = get-vmhost | |
| PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> echo $esx | |
| Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB Version | |
| ---- --------------- ---------- ------ ----------- ----------- ------------- ------------- ------- | |
| 192.168.1.30 Connected PoweredOn 2 252 5600 3.727 4.000 5.5.0 | |
| 10.0.0.30 Connected PoweredOn 4 1385 11196 3.725 4.000 5.5.0 | |
| vSphere PowerCLI>foreach ($Name in $esx) {Remove-VMHost $Name} | |
| vSphere PowerCLI>foreach ($Name in $esx) {Add-VMHost $Name -Location vc1 -User root -Password VMware123! -force} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment