1. 查看虚拟机列表
PS /root> Get-VM
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
mysql数据库测试 PoweredOn 8 32.000
中间件测试服务器 PoweredOn 8 16.000
test01 PoweredOn 2 4.000
VMware vCenter Serv… PoweredOn 4 16.000
平台测试 PoweredOn 32 128.000
2. 查看宿主机列表
PS /root> $vm = Get-VM -Name test01
PS /root> $vm.VMHost
Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB Version
---- --------------- ---------- ------ ----------- ----------- ------------- ------------- -------
172.15.7.131 Connected PoweredOn 24 1072 50280 119.252 127.543 6.5.0
PS /root> $vmHosts=Get-VMHost
PS /root> $vmHosts
Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB Version
---- --------------- ---------- ------ ----------- ----------- ------------- ------------- -------
172.15.7.131 Connected PoweredOn 24 1072 50280 119.252 127.543 6.5.0
172.15.7.132 Connected PoweredOn 24 5541 50280 106.914 127.543 6.5.0
172.15.7.133 Connected PoweredOn 24 1035 50280 19.159 127.543 6.5.0
3. 根据虚拟机名称查看详细信息
- 查看宿主机信息
PS /root> $vm = Get-VM -Name test01
PS /root> $vm.VMHost
Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB Version
---- --------------- ---------- ------ ----------- ----------- ------------- ------------- -------
172.15.7.131 Connected PoweredOn 24 1260 50280 119.265 127.543 6.5.0