日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

实用 —— PowerCLI (一)

發布時間:2024/4/14 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 实用 —— 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

轉載于:https://blog.51cto.com/virtualbox/1358364

總結

以上是生活随笔為你收集整理的实用 —— PowerCLI (一)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。