报错如图
PS C:\Users\admin> Connect-VIServer -Server 160.x.x.10 -Protocol https _user bu\rjk Connect-VIServer : The 'Connect-VIServer' command was found in the module 'VMware.VimAutomat could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'. At line:1 char:1 + Connect-VIServer -Server 160.x.x.10 -Protocol https _user bu\rjk ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundE + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
解决方法
1 PS C:\Windows\system32> Set-ExecutionPolicy remotesigned 2 3 执行策略更改 4 执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略? 5 [Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”):
查看路径把,相应版本的powercli解压缩后,把文件拷贝到如下目录
PS C:\Windows\system32> $env:PSModulePath C:\Users\maym-H770\Documents\WindowsPowerShell\Modules;
C:\Program Files\WindowsPowerShell\Modules
;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files\WindowsPowerShell\Modules 我是将解压后的文件拷贝到此
之后执行import
PS C:\Windows\system32> Import-Module VMware.Powercli Welcome to VMware PowerCLI! Log in to a vCenter Server or ESX host: Connect-VIServer To find out what commands are available, type: Get-VICommand To show searchable help for all PowerCLI commands: Get-PowerCLIHelp Once you've connected, display all virtual machines: Get-VM If you need more help, visit the PowerCLI community: Get-PowerCLICommunity Copyright (C) VMware, Inc. All rights reserved.
之后执行连接VC
PS C:\Windows\system32> Connect-VIServer 10.100.91.50
就可以正常使用了
标签:PS,Windows,system32,报错,Connect,powercli,解决,VIServer,VMware From: https://www.cnblogs.com/maym/p/17755235.html