Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell Invoke VMScript对象引用未设置为对象的实例。来自VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion()_Powershell_Vmware_Powercli_Vix - Fatal编程技术网

Powershell Invoke VMScript对象引用未设置为对象的实例。来自VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion()

Powershell Invoke VMScript对象引用未设置为对象的实例。来自VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion(),powershell,vmware,powercli,vix,Powershell,Vmware,Powercli,Vix,调用VMScript 对象引用未设置为对象的实例 最终来自: VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion() 在我的机器上,当指向操作系统为Linux风格的VMGuest时,调用VMScript失败。 *另一个开发人员可以毫无问题地运行此脚本。 *他和我已经匹配了PowerCLI和Vix版本。 *这不是身份验证问题 **我可以转到他的机器,使用我的windows凭据,然后脚本运行 **他可以来到我的机器,使用他的wind

调用VMScript
对象引用未设置为对象的实例

最终来自:
VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion()

在我的机器上,当指向操作系统为Linux风格的VMGuest时,调用VMScript失败。
*另一个开发人员可以毫无问题地运行此脚本。
*他和我已经匹配了PowerCLI和Vix版本。
*这不是身份验证问题
**我可以转到他的机器,使用我的windows凭据,然后脚本运行
**他可以来到我的机器,使用他的windows凭据和脚本

C:\run\u a\u bash\u script.ps1: 脚本结果: 及

Windows操作系统、控制面板/程序/程序和功能
  • VMWare VIX 1.12.1.33347
  • VMWare vSphere PowerCLI 5.5.0.5836
PowerCLI版本/配置 对于一个有效的 对于那个不起作用的 如本文所述:
*
*
*

问题是VIX库是32位的,我使用64位Powershell运行脚本

在64位操作系统上:
*Powershell 64位为默认值
*32位Powershell的路径为:%systemroot%\syswow64\windowspowershell\v1.0\

用于测试powershell进程是32位还是64位的简单powershell语句:

 [Environment]::Is64BitProcess

我也面临同样的问题。我的Invoke-VMScript无法工作。深入研究之后,我发现我的vCenter服务器(在我的例子中是目标服务器)具有ipv6配置。我删除了ipv6配置并将其更改为ipv4配置


我的问题解决了。

我想,你在撒谎。
PS c:\> C:\run_a_bash_script.ps1
Name                           Port  User                          
----                           ----  ----                          
<# VCenter FQDN #>             443   <# AD username #>                  

========ERROR SUMMARY=========================================================================================

1/14/2014 4:30:22 PM    Invoke-VMScript     Object reference not set to an instance of an object.   
Object reference not set to an instance of an object.

NotSpecified: (:) [Invoke-VMScript], ViError

at <ScriptBlock>, C:\projects\github\nodeVM\scripts\powershell\vmIpChangeLin.ps1: line 20
VALUE_IS_NULL
   at VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion()
   at VMware.VimAutomation.ViCore.Impl.V1.VixHelper.TryValidateVixVersion()
   at VMware.VimAutomation.ViCore.Impl.V1.Service.VmGuestServiceImpl.<>c__DisplayClassc.<RunScriptInGuest>b__b(ClientSideTask , Object )
   at VMware.VimAutomation.Sdk.Util10.Task.ClientSideTaskImpl.ThreadProc(Object obj)
At C:\projects\github\nodeVM\scripts\powershell\vmIpChangeLin.ps1:20 char:5
+     Invoke-VMScript -VM $vmName -ScriptText $script -GuestUser $vmUser -GuestPas ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==============================================================================================================


     BEGIN---> describe_error_briefly

          BEGIN---> exception
               exception                            =[NULL]
          END---> exception


          BEGIN---> run_time_exception
               is a runtime exception?              =[NO]
          END---> run_time_exception


          BEGIN---> error_record
               CategoryInfo                         =[NotSpecified: (:) [Invoke-VMScript], ViError]
               ErrorDetails                         =[VALUE_IS_NULL]
               FullyQualifiedErrorId                =[Client20_ClientSideTaskImpl_ThreadProc_UnhandledException,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript]
               ScriptStackTrace                     =[at <ScriptBlock>, C:\projects\github\nodeVM\scripts\powershell\vmIpChangeLin.ps1: line 20]
               TargetObject                         =[VALUE_IS_NULL]

               BEGIN---> exception
                    Data                                 =[System.Collections.ListDictionaryInternal]
                    Message                              =[1/14/2014 4:30:22 PM Invoke-VMScript     Object reference not set to an instance of an object.   ]
                    Source                               =[VALUE_IS_NULL]
                    StackTrace                           =[VALUE_IS_NULL]
                    TargetSite                           =[VALUE_IS_NULL]

                    BEGIN---> exception
                         Data                                 =[System.Collections.ListDictionaryInternal]
                         Message                              =[Object reference not set to an instance of an object.]
                         Source                               =[VMware.VimAutomation.ViCore.Impl]
                         StackTrace                           =[   at VMware.VimAutomation.ViCore.Impl.V1.VixHelper.GetVixVersion()
                                                               |   at VMware.VimAutomation.ViCore.Impl.V1.VixHelper.TryValidateVixVersion()
                                                               |   at VMware.VimAutomation.ViCore.Impl.V1.Service.VmGuestServiceImpl.<>c__DisplayClassc.<RunScriptInGuest>b__b(ClientSideTask , Object )
                                                               |   at VMware.VimAutomation.Sdk.Util10.Task.ClientSideTaskImpl.ThreadProc(Object obj)]
                         TargetSite                           =[System.String GetVixVersion()]

                         BEGIN---> exception
                              exception                            =[NULL]
                         END---> exception

                    END---> exception

               END---> exception


               BEGIN---> invocation_info
                    PositionMessage                      =[At C:\projects\github\nodeVM\scripts\powershell\vmIpChangeLin.ps1:20 char:5
                                                          |+     Invoke-VMScript -VM $vmName -ScriptText $script -GuestUser $vmUser -GuestPas ...
                                                          |+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
               END---> invocation_info

          END---> error_record

     END---> describe_error_briefly
write-host ( [VMware.VimAutomation.ViCore.Impl.V1.VixHelper] | Get-Member -MemberType:All | Where-Object { $_.Name -like "%ersion%" } | Format-Table | Out-String )
write-host ( [VMware.VimAutomation.ViCore.Impl.V1.VixHelper] | Get-Member -MemberType:All -Static | Where-Object { $_.Name -like "%ersion%" } | Format-Table | Out-String )
Function get_debug_info()
{
    write-host "-----------Get-PowerCLIConfiguration--------------------------------------------------"
    write-host ( Get-PowerCLIConfiguration | Format-List | Out-String )
    write-host "-----------Get-PowerCLIVersion--------------------------------------------------"
    write-host ( Get-PowerCLIVersion | Format-List | Out-String )
    return $null
}
-----------Get-PowerCLIConfiguration-------------------------------------------------- 


DefaultVIServerMode : Multiple 
ProxyPolicy : UseSystemProxy 
DisplayDeprecationWarnings : True 
InvalidCertificateAction : Ignore 
WebOperationTimeoutSeconds : 300 
VMConsoleWindowBrowser : 
Scope : Session 

DefaultVIServerMode : Multiple 
ProxyPolicy : 
DisplayDeprecationWarnings : 
InvalidCertificateAction : 
WebOperationTimeoutSeconds : 
VMConsoleWindowBrowser : 
Scope : User 

DefaultVIServerMode : Single 
ProxyPolicy : 
DisplayDeprecationWarnings : True 
InvalidCertificateAction : Ignore 
WebOperationTimeoutSeconds : 
VMConsoleWindowBrowser : 
Scope : AllUsers 




-----------Get-PowerCLIVersion-------------------------------------------------- 


Major : 5 
Minor : 5 
Build : 1295336 
Revision : 0 
Copyright : Copyright © VMware, Inc. 1998-2013 
Company : VMware, Inc. 
UserFriendlyVersion : VMware vSphere PowerCLI 5.5 Release 1 build 1295336 
SnapinVersions : {VMWare AutoDeploy PowerCLI Component 5.5 build 1262826, VMWare ImageBuilder PowerCLI Component 5.5 build 1262826, VMware License PowerCLI Component 5.5 build 1265954, VMware VDS PowerCLI Component 5.5 build 1295334...} 
-----------Get-PowerCLIConfiguration--------------------------------------------------


DefaultVIServerMode        : Single
ProxyPolicy                : UseSystemProxy
DisplayDeprecationWarnings : True
InvalidCertificateAction   : Ignore
WebOperationTimeoutSeconds : 300
VMConsoleWindowBrowser     : 
Scope                      : Session

DefaultVIServerMode        : Single
ProxyPolicy                : 
DisplayDeprecationWarnings : 
InvalidCertificateAction   : 
WebOperationTimeoutSeconds : 
VMConsoleWindowBrowser     : 
Scope                      : User

DefaultVIServerMode        : Multiple
ProxyPolicy                : UseSystemProxy
DisplayDeprecationWarnings : True
InvalidCertificateAction   : Ignore
WebOperationTimeoutSeconds : 
VMConsoleWindowBrowser     : 
Scope                      : AllUsers




-----------Get-PowerCLIVersion--------------------------------------------------


Major               : 5
Minor               : 5
Build               : 1295336
Revision            : 0
Copyright           : Copyright © VMware, Inc. 1998-2013
Company             : VMware, Inc.
UserFriendlyVersion : VMware vSphere PowerCLI 5.5 Release 1 build 1295336
SnapinVersions      : {VMWare AutoDeploy PowerCLI Component 5.5 build 1262826, VMWare ImageBuilder PowerCLI Component 5.5 build 1262826, VMware License PowerCLI Component 5.5 build 1265954, VMware VDS PowerCLI Component 5.5 build 1295334...}
 [Environment]::Is64BitProcess