首页 > 其他 > 详细

实用 —— PowerCLI (三)

时间:2014-03-01 14:04:40      阅读:550      评论:0      收藏:0      [点我收藏+]

 

 

一、PowerCLI基础命令

二、PowerCLI之快照

三、PowerCLI之ESXi

 

 

 

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

1、

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

 

bubuko.com,布布扣

2、

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

 

bubuko.com,布布扣

3、

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

 

bubuko.com,布布扣

 

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

 

bubuko.com,布布扣

5、

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

 

bubuko.com,布布扣

6、

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

 

bubuko.com,布布扣

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

 

bubuko.com,布布扣

8、

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

 

bubuko.com,布布扣

9、

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

 

bubuko.com,布布扣

10、

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

 

bubuko.com,布布扣

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

bubuko.com,布布扣

 

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

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

实用 —— PowerCLI (三),布布扣,bubuko.com

实用 —— PowerCLI (三)

原文:http://virtualbox.blog.51cto.com/531002/1365128

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!