更新时间:2022-09-21 20:59:14
虚拟机运行在ESXi之上,是虚拟机稳定运行的基础
1、
1
2
|
# pick a particular host./选择特定主机 $h = get -vmhost 10.132 . 97.19
|
2、
1
2
3
|
# Let's take a look at advanced configuration options. #查看主机高级配置,非常多参数,所以带个more会按照窗口显示 $h | Get-VMHostAdvancedConfiguration | more |
3、
1
2
3
|
# That's a lot of stuff! How many options are there exactly? #非常多参数,有多少选项是你需要的选择的 $h | Get-VMHostAdvancedConfiguration | Measure- Object
|
4、
1
2
3
4
|
# That 's not right??? Something is funny about the object. Let' s take a closer look at it.
#如果没有你需要的,我们可以更精细的查看 $config = $h | Get-VMHostAdvancedConfiguration $config | Get-Member |
5、
1
2
|
# How do we get a specific value? 来看下我们怎样获取一些指定的参数值
$config. "Cpu.MoveCurrentRunnerPcpus"
|
6、
1
2
3
|
# Let's count the number of advanced options. #让我们来统计高级选项的数量 $config.Keys | measure-object |
7、
1
2
3
|
# Use case : NFS tuning.
# Let's set the max NFS heartbeat failures to 20 across all our hosts.
$h | Get-VMHostAdvancedConfiguration | select -expand Keys | Where { $_ -like "NFS*" }
|
8、
1
2
3
|
# Now let's change some settings. # Set-VMHostAdvancedConfiguration is easy compared to Get-
# Get-VMHost | Set-VMHostAdvancedConfiguration -name NFS.HeartbeatMaxFailures -Value 10
|
9、
1
2
3
|
# Increase the heap size to 30mb.这些命令都比较方便,不用在图形界面点过来点过去, #为后期的自动化脚本实现提供基础命令 Get-VMHost | Set-VMHostAdvancedConfiguration -name Net.TcpipHeapSize -Value 30
|
10、
1
2
|
# Setting DNS is easy with Set-VMHostNetwork
Get-VMHost | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress 10.132 . 97.25
|
1
2
|
# Hostname, ConsoleGateway, DNSAddress , IP, SubnetMask, ConsoleGateway, DNSAddress, Devicename 选择的参数非常之多 Get-VMHost | Get-VMHostNetwork | Select Hostname, PortGroupName, IP |
谢谢,感兴趣可以继续跟文。