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
IViewCommandGet-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