VMware PowerCLI安裝


Install PowerCLI

Ⅰ在線安裝

在線安裝可以直接從 PowerShell Gallery安裝

Install-Module -Name VMware.PowerCLI

Ⅱ離線安裝

  1. 下載PowerCLI Module.zip文件 from here

  2. 檢查PowerShell模塊路徑,執行以下命令

 $env:PSModulePath
  1. 將下載的.zip文件解壓縮到PowerShell模塊路徑

  2. 解鎖文件

cd path_to_powershell_modules_folder
Get-ChildItem * -Recurse | Unblock-File
  1. 執行以下命令以驗證PowerCLI模塊是否可用
Get-Module -Name VMware.PowerCLI -ListAvailable

預操作:以下兩條執行一次以后就不用了。

  • 關閉CEIP( Customer Experience Improvement Program 客戶體驗改進計划)
    Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false

  • 忽略證書驗證
    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

打開PowerShell導入模塊
Import-Module VMware.PowerCLI


將PowerCLI加載到PowerShell ISE中

適用於PowerCLI 6.x安裝版本

#查看當前profile文件目錄
PS C:\Users\Administrator> Write-Host $profile
C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1

#創建profile文件
PS C:\Users\Administrator> New-Item -ItemType file $profile -force


    目錄: C:\Users\Administrator\Documents\WindowsPowerShell


Mode                LastWriteTime         Length Name                                                                                                                                                
----                -------------         ------ ----                                                                                                                                                
-a----         2021/4/8     12:45              0 Microsoft.PowerShellISE_profile.ps1     
  • Initialize-PowerCLIEnvironment.ps1中的內容粘貼到剛創建的profile文件中
  • powercli啟動文件路徑
    C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts

PowerCLI6.x安裝版的會有這個,我使用的12.x並沒有這個目錄和文件
如果有哪位知道怎么在PowerShell ISE中啟動加載PowerCLI 12.x的可以留言告知


參考&引用:

  1. 安裝PowerCLI
  2. VMware PowerCLI 12.2.0用戶手冊
  3. https://blogs.vmware.com/PowerCLI/2017/04/powercli-install-process-powershell-gallery.html
  4. https://code.vmware.com/docs/7053/cmdlet-reference

©轉載請注明出處


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM