VMware

Windows10 安装 VMware PowerCLI

2023年1月1日

第一种方法、PowerCLI在线安装
我的电脑始终安装不成功,可能是国内墙的原因,推荐第二种方法

窗口键+S 打开搜索,输入 PowerShell

Install-Module -Name VMware.PowerCLI -Scope CurrentUser

如果您希望它可供计算机的所有用户使用,则您的PowerShell会话必须以管理员身份运行,并且将通过将Scope参数更改为AllUsers,为所有用户自动安装PowerCLI。

第二种方法、离线安装
2.1 下载离线zip
https://code.vmware.com/web/dp/tool/vmware-powercli/

2.2 解压到ps模块目录下
C:\Windows\System32\WindowsPowerShell\v1.0\Modules

2.3 打开PowerShell导入模块
修改Windows10执行PowerShell脚本安全等级,远程脚本需要前面,本地脚本不需要。

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  • AllSigned
    只允许带签名的PS脚本运行
  • Bypass
    放弃治疗,随便运行
  • RemoteSigned
    远程脚本需要签名,本地脚本不用。就是我们上面设置的级别,远程指的是网上下载或电子邮件等途径获得的脚本。服务器系统默认就是这个级别。
  • Restricted
    受限制的,不允许运行脚本,只执行在PowerShell窗口里敲的命令。这个是个人系统默认的运行授权级别。
  • Undefined
    表示运行级别尚未定义。但此时实际是执行上面提到的系统默认运行级别。
  • Unrestricted
    在Win平台之外使用PowerShell时的默认级别。允许全部脚本执行,对非本地脚本给出提醒。

导入模块

Import-Module VMware.PowerCLI

验证是否安装成功

Get-Module VMware* -ListAvailable

可选操作:

关闭PowerCLI提示

关闭CEIP( Customer Experience Improvement Program 客户体验改进计划)

Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false

忽略证书验证

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

官方文档:

Online Documentation – PowerCLI User’s Guide – VMware {code}

参考链接:

win10安装VMware PowerCLI

https://www.bilibili.com/read/cv7286933/

You Might Also Like

No Comments

Leave a Reply

%d 博主赞过: