实用 —— PowerCLI (三)

 

 

一、PowerCLI基础命令

二、PowerCLI之快照

三、PowerCLI之ESXi

 

 

 

虚拟机运行在ESXi之上,是虚拟机稳定运行的基础

1、

# pick a particular host./选择特定主机
$h = get-vmhost 10.132.97.19

 

image_thumb[41]

2、

# Let's take a look at advanced configuration options.
#查看主机高级配置,非常多参数,所以带个more会按照窗口显示
$h | Get-VMHostAdvancedConfiguration | more

 

Image635292005218028093_thumb[5]

3、

# That's a lot of stuff! How many options are there exactly?
#非常多参数,有多少选项是你需要的选择的
$h | Get-VMHostAdvancedConfiguration | Measure-Object

 

image_thumb[24]

 

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

 

image_thumb[26]

5、

# How do we get a specific value? 来看下我们怎样获取一些指定的参数值
$config."Cpu.MoveCurrentRunnerPcpus"

 

image_thumb[28]

6、

# Let's count the number of advanced options.
#让我们来统计高级选项的数量
$config.Keys | measure-object

 

image_thumb[30]

7、

# 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*" }

 

image_thumb[32]

8、

# Now let's change some settings.
# Set-VMHostAdvancedConfiguration is easy compared to Get-
# Get-VMHost | Set-VMHostAdvancedConfiguration -name NFS.HeartbeatMaxFailures -Value 10

 

image_thumb[34]

9、

# Increase the heap size to 30mb.这些命令都比较方便,不用在图形界面点过来点过去,
#为后期的自动化脚本实现提供基础命令
Get-VMHost | Set-VMHostAdvancedConfiguration -name Net.TcpipHeapSize -Value 30

 

image_thumb[36]

10、

# Setting DNS is easy with Set-VMHostNetwork
Get-VMHost | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress 10.132.97.25

 

image_thumb[38]

# Hostname, ConsoleGateway, DNSAddress ,  IP, SubnetMask, ConsoleGateway, DNSAddress, Devicename  选择的参数非常之多
Get-VMHost | Get-VMHostNetwork | Select Hostname, PortGroupName, IP

image_thumb[40]

 

谢谢,感兴趣可以继续跟文。

本文出自 “virtualbox” 博客,转载请与作者联系!

你可能感兴趣的:(vsphere,esxi,tim2009,PowerCLI)