HOST MANAGEMENT
Add a new ESXi to the inventory
Add-VMHost <fqdn or ip> ‑Location (Get-Cluster <cLustername>) ‑User root ‑Password <password>
Set a host to maintenand mode
Set-VMHost ‑VMHost <host> ‑State "Maintenance"
Power operations on ESXi
Restart-VMHost ‑VMHost <host>
Stop-VMHost ‑VMHost <host>
Retrieves information about host services
Get-VMHostService <host>
Restart a specific host service
Get-VMHostService <host> | ? {($_.Key ‑eq "TSM-ssh")} | Restart-VMHostService
List VM host network details and output to the PowerCLI console
Get-VMHostNetworkAdapter | select VMhost, Name, IP, SubnetMask,Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, BitRatePerSec
Output to CSV VM host network details
Get-VMHostNetworkAdapter | select VMhost, Name, IP, SubnetMask, Mac, PortGroupName, vMotionEnabled, mtu, FullDuplex, BitRatePerSec | Export-Csv C:\VMHostNetworkDetails.csv
Enabling SSH on host via Powercli
get-vmhostservice | where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
Enabling SSH on host via Powercli
get-vmhostservice | where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
Enabling SSH on for multiple host’s via Powercli
1. Connect-VIServer -Server 192.168.X.X -user <your account> -password <your password>
2. Get-VMHost | foreach { get-vmhostservice -VMHost $_.name | where {$_.Key -eq "TSM-SSH"} | Start-VMHostService}
Disabling SSH on for multiple host’s via Powercli
1. Connect-VIServer -Server 192.168.X.X -user <your account> -password <your password>
2. Get-VMHost | foreach { get-vmhostservice -VMHost $_.name | where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService}
Backup ESXi configuration
get-vmhost | get-VMHostFirmware -BackupConfiguration -DestinationPath <path>
Restore ESXi configuration from Backup
Set-VMHostFirmware -VMHost <ip> -Restore -Force -SourcePath <sourcepath>
Please Comment and Subscribe