实用 —— PowerCLI (一)
2014-02-12 11:30
239 查看
近来,安装过较多产品,深感疲乏,犹如农民伯伯在家研究种子,却不种到地里,还不如往地里丢蚕豆,任其生长,还有收成。
于是,想做一些拿来就能用的文档,方便学习,《实用——PowerCLI》系列就是这样。
现在没有大纲,写到哪,算到哪,形式为命令+截图。
一、PowerCLI基础命令
二、PowerCLI之快照
三、PowerCLI之ESXi
Powercli是一个命令行自动化和脚本工具,它为VMware公司的vSphere和vCloud产品提供了一个的Windows PowerShell接口。
Powercli包括高级命令,和低级别vSphere和vCloud API的访问
Powercli的安装在前面博客介绍过,这里提供链接http://virtualbox.blog.51cto.com/531002/978907
在VMware Community社区的WorkShop里,包括了很多基础的脚本例子,我们先从这里开始
1、默认界面
2、
3、
4、
# 查看虚拟交换机帮助
help Get-VirtualSwitch
5、
6、
7、
8、
9、
10、
11、
12、
13、
14、
下载地址(最新版本未PowerCli 5.5,Get-PowerCLIVersion)
https://developercenter.vmware.com/web/dp/sdk/55/vsphere-powercli
于是,想做一些拿来就能用的文档,方便学习,《实用——PowerCLI》系列就是这样。
现在没有大纲,写到哪,算到哪,形式为命令+截图。
一、PowerCLI基础命令
二、PowerCLI之快照
三、PowerCLI之ESXi
Powercli是一个命令行自动化和脚本工具,它为VMware公司的vSphere和vCloud产品提供了一个的Windows PowerShell接口。
Powercli包括高级命令,和低级别vSphere和vCloud API的访问
Powercli的安装在前面博客介绍过,这里提供链接http://virtualbox.blog.51cto.com/531002/978907
在VMware Community社区的WorkShop里,包括了很多基础的脚本例子,我们先从这里开始
1、默认界面
2、
# To see what PowerCLI can do, start with Get-VICommand # 查看PowerCLI能做哪些 Get-VICommand
3、
# There are more than 150 commands, called "cmdlets".That's a lot! You can narrow your search based on something that interests you. #有超过150个叫“cmdlets”的命令行, 您可以根据你的兴趣缩小搜索范围 Help *VM*
4、
# You can also use "help" to narrow your search. Let's say you want to do something with virtual switches. #你还可以使用”help”来缩小搜索范围, 让我们来搜小搜索virtualswitchs的访问 。 help *virtualswitch*
# 查看虚拟交换机帮助
help Get-VirtualSwitch
5、
# Or maybe you care about firewall rules. #或者你可以看下防火墙相关的命令 help *firewall*
6、
# Cmdlets exist to get all your favorite objects. #Cmdlets存在一些你很感兴趣的对象 Get-Datacenter Get-VMHost Get-Cluster Get-VM
7、
# These commands are made to work with each other.You can easily use a sequence of them to filter. #这些命令是相互作用的 ,你可以很轻松的进行过滤选择 Get-VMHost
8、
Get-Cluster mycluster | Get-VMHost # Or we can restrict VMs to a given host. #或者我们可以限制虚拟机在指定的主机上 Get-VM | Measure-Object Get-VMHost esxi.tim.local | Get-VM | Measure-Object
9、
# We can easily identify the datastore a VM is on. #我们可以很容易识别虚拟机在哪个数据存储上 Get-VM vCenter Get-VM vCenter | Get-Datastore
10、
# We can even go the other way. #我们甚至可以走另外一条路,查看数据存储上有哪些虚拟机 Get-Datastore 20storage | Get-VM
11、
# Objects are formatted when they are printed to the screen.But, there may be more to them than what you see with default output. #输出屏幕上时它们被表格化 ,但是,默认输出的比你想看的多 Get-Datastore Get-Datastore | Format-Table * Get-Datastore | Format-List *
12、
# Some objects are rich with properties. #一些项目有丰富的内容 Get-VM | Format-List *
13、
#可以延伸下,客户说只看指定的虚拟机AD-25的虚拟机信息。 Get-VM AD-25 | Format-List *
14、
# Use the Select cmdlet to choose just the stuff you care about. #使用cmdlet去选择你关心的东西 Get-VM | Select Name, Host, NumCpu, MemoryMB, HARestartPriority | Format-Table
下载地址(最新版本未PowerCli 5.5,Get-PowerCLIVersion)
https://developercenter.vmware.com/web/dp/sdk/55/vsphere-powercli
相关文章推荐
- 实用 —— PowerCLI (三)
- 实用 —— PowerCLI (二)
- FMS3中的实用工具——far.exe
- 一个比较实用的powercli统计命令脚本
- Team Foundation Server 2008实用教程系列(一)—— 添加项目管理员
- 实用PowerCLI脚本
- 环保软件——由MSN“绿行者”所想到的
- 超实用的Linux/Unix快捷键大汇总(开发、管理)(2)(转)
- MyEclipse上Git插件EGIT 实用手册之一_安装
- 实用JS系列——BOM常用对象
- 分享一个非常实用的PHP框架--oFrame
- Maven pom.xml配置信息实用模板
- 3.2 鼠标事件 - 《C# 2.0实用开发详解》
- 位运算简介及实用技巧(二):进阶篇(1)
- 实用信息查询接口
- Android中StrictMode实用调试工具
- Java基础学习(四)—面向对象(下)
- OCM_第十九天课程:Section9 —》Data Guard _ DATA GUARD 原理/DATA GUARD 应用/DATA GUARD 搭建
- 超级实用且不花哨的js代码大全
- Oracle bbed 五个 实用示例