操作系统版本:windows 2008 R2 Enterprise Service Pack 1
PowerShell版本5.0
.net framework 4.5.2
1、在PowerShell提示符下执行
查看是否有相应的模块:
Find-Module -Name VMware.PowerCLI
下载相应的模块到C:\PowerCLI 目录(由用户指定目录名称 )
Save-Module -Name VMware.PowerCLI -Path C:\PowerCLI
2、在离线电脑中的PowerShell提示符下执行
$ENV:PSModulePath
看到相应的目录的环境变量,把下载好的文件拷贝过去
3、安装.Netframework 4.5.2,
4、安装WMF 5.1 for Windows Server 2008 R2 and Windows 7
5、经测试,对于vCenter5.0,5.1,6.0,6.5都可以读到相应的信息。
备注:
(1)连接connect-viserver,报错:
WARNING: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect once or to add a permanent exception for this server.
connect-viserver : 10/17/16 3:00:15 PM Connect-VIServer An error occurred while sending the request.
At line:1 char:1
connect-viserver 10.192.116.20 -User administrator@vsphere.local -Pas ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
处理方法:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
连接:
http://powercli-core.readthedocs.io/en/latest/faq.html
(2)
Windows 2008 R2 如何正确的升级到PowerShell 5.0
下载连接:
(a).Net framework 4.5.2
https://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe
(b)Install WMF 5.1 for Windows Server 2008 R2 and Windows 7
下载连接:
参考链接:https://docs.microsoft.com/en-us/powershell/wmf/5.1/install-configure
(3)参考的安装流程文档
(a)
Welcome PowerCLI to the PowerShell Gallery – Install Process Updates
参考连接:https://blogs.vmware.com/PowerCLI/2017/04/powercli-install-process-powershell-gallery.html
(b)
VMware PowerCLI Blog
New Release: VMware PowerCLI 10.1.0
参考链接:https://blogs.vmware.com/PowerCLI/2018/04/new-release-vmware-powercli-10-1-0.html#comment-33455