Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 193198

Get-VIObjectByVIView error in PowerShell v3

$
0
0

In PowerShell v3 the Get-VIObjectByVIView cmdlet generates two errors if you specify the MoRef of a virtual machine as a parameter. It works without any problem in PowerShell v2.

 

I know that PowerShell v3 is not supported with "VMware vSphere PowerCLI 5.1 Release 1 build 793510" that I am using. I just wanted to let the PowerCLI team know about this problem.

 

It has something to do with running PowerShell v3 using a single-threaded apartment, which is the default in PowerShell v3. If you start PowerShell v3 with the -mta parameter this problem does not occur.

PowerCLI C:\users\robert> $vm = Get-VM Storage-Test
PowerCLI C:\users\robert> $vm.Id | Get-VIObjectByVIView
Get-VIObjectByVIView : 7-1-2013 15:37:24    Get-VIObjectByVIView        The object has already been deleted or has not been completely created
At line:1 char:10
+ $vm.Id | Get-VIObjectByVIView
+          ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VIObjectByVIView], ManagedObjectNotFound
    + FullyQualifiedErrorId : Client20_QueryServiceImpl_RetrievePropertiesEx_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIObjectByV
   IViewCommand

Get-VIObjectByVIView : 7-1-2013 15:37:24    Get-VIObjectByVIView        The object has already been deleted or has not been completely created
At line:1 char:10
+ $vm.Id | Get-VIObjectByVIView
+          ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VIObjectByVIView], ManagedObjectNotFound
    + FullyQualifiedErrorId : Client20_QueryServiceImpl_RetrievePropertiesEx_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIObjectByV
   IViewCommand


Name                 PowerState Num CPUs MemoryGB
----                 ---------- -------- --------
storage-test         PoweredOn  1        4,000


Viewing all articles
Browse latest Browse all 193198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>