实用 —— PowerCLI (三)

本文介绍使用PowerCLI进行ESXi主机管理的具体操作,包括选取特定主机、查看及修改高级配置选项、设置NFS心跳失败次数及调整堆大小等实用命令。

 

 

一、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]

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值