任何人都可以在这里协助我重置全局:DefaultVIServer和全局:DefaultVIServers系统variables为$ null?
因为即使重新安装PowerCLi并将其升级到5.1U2之后,我也无法再使用PowerShell执行任何操作,以下是版本信息和configuration信息的输出:
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeoutSeconds ----- ----------- ------------------- ------------------------ -------------------------- -------------------------- Session UseSystemProxy Multiple Unset True 300 User UseSystemProxy Multiple AllUsers Single WARNING: Error initializing default drive: 'Unable to find a default server with Active Directory Web Services running.'. PowerCLI Version ---------------- VMware vSphere PowerCLI 5.1 Release 2 build 1012425 --------------- Snapin Versions --------------- VMWare AutoDeploy PowerCLI Component 5.1 build 768137 VMWare ImageBuilder PowerCLI Component 5.1 build 768137 VMware License PowerCLI Component 5.1 build 669840 VMware VDS PowerCLI Component 5.1 build 1012428 VMware vSphere PowerCLI Component 5.1 build 1012428
由于这个错误,我甚至不能发出一个简单的PowerCLi命令来获取我的虚拟机列表,看到以下错误:
WARNING: Error initializing default drive: 'Unable to find a default server with Active Directory Web Services running.'. Get-VM : You have modified the global:DefaultVIServer and global:DefaultVIServers system variables. This is not allowed. Please reset them to $null and reconnect to the vSphere server. At C:\Users\Albert\AppData\Local\Temp\4a44b139-36b2-4045-bf3c-a51cff5472b4.ps1:1 char:7 + Get-VM <<<< + CategoryInfo : NotSpecified: (:) [Get-VM], InvalidState + FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.InvalidState,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM
任何帮助将不胜感激。
谢谢
我不确定你是如何设置这些的,但是你可以使用下面的方法删除variables(而不是空的)。
1)首先用Get-Variable在PowerCLI会话中检查你所拥有的东西(你应该看到类似的东西,但可能是服务器的值)
名称值
---- -----
全球:DefaultVIServer
全球:DefaultVIServers {}
2)使用Remove-Variable DefaultVIServer和Remove-Variable DefaultVIServer删除每个3)尝试使用Connect-VIServer连接到正确的vCenter yourvcenter.domain.com *
如果您不断重置variables,则可能已经在启动文件(C:\ Program Files(x86)\ VMware \ Infrastructure \ vSphere PowerCLI \ Scripts \ Initialize-PowerCLIEnvironment.ps1)中定制了一些内容,因此您可能需要更换/删除那里的条目(从来没有尝试过,只是猜测)
PS。 对不起格式化乱七八糟,仍然习惯于格式