VMware Cloud Community
Phildean_dg
Contributor
Contributor

get-datastore -tag fails with "Value cannot be null" to vCenter 7.0.3 but works with 6.5

PS D:\Scripts\@Prod\esx\deploy> Get-Datastore -Tag PC3_DEPLOY
Get-Datastore : 11/12/2021 10:54:17 AM Get-Datastore Value cannot be null.
Parameter name: collection
At line:1 char:1
+ Get-Datastore -Tag PC3_DEPLOY
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Datastore], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetDatastore

PS D:\Scripts\@Prod\esx\deploy> $error[0].Exception | select *


ErrorId : Core_BaseCmdlet_UnknownError
ErrorCategory : NotSpecified
TargetObject :
RecommendedAction : Error occured while executing cmdlet: Get-Datastore. Check inner exception for more details.
SessionId :
ConnectionId :
Severity : Error
Message : 11/12/2021 10:54:17 AM Get-Datastore Value cannot be null.
Parameter name: collection
Data : {ParameterValues}
InnerException : System.ArgumentNullException: Value cannot be null.
Parameter name: collection
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at VMware.VimAutomation.ViCore.Impl.V1.Service.ViCoreObjectInteropCoreServiceProviderImpl.GetObn
(IList`1 connectionIdList, IList`1 objectNameList, IList`1 objectInterfaceTypeList, IList`1
contextList)
at VMware.VimAutomation.Sdk.Impl.V1.CoreServiceImpl.GetObn(IList`1 connectionIdList, IList`1
objectNameList, IList`1 objectInterfaceTypeList, IList`1 contextList, String contextRelationName)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.GetObjectsByNameCore(PropertyInfo
parameter, String objectName)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectByNameCore(PropertyInfo
parameter, String objectName)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectByName(PropertyInfo
parameter)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectsByName()
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.SelectObjectsByName()
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
TargetSite : Void ThrowTerminatingError(System.Management.Automation.ErrorRecord)
StackTrace : at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
HelpLink :
Source : System.Management.Automation
HResult : -2146232832

 

PS D:\Scripts\@Prod\esx\deploy> $error[0].Exception.InnerException | select *


Message : Value cannot be null.
Parameter name: collection
ParamName : collection
Data : {}
InnerException :
TargetSite : Void ThrowArgumentNullException(System.ExceptionArgument)
StackTrace : at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at
VMware.VimAutomation.ViCore.Impl.V1.Service.ViCoreObjectInteropCoreServiceProviderImpl.GetObn(IList`1
connectionIdList, IList`1 objectNameList, IList`1 objectInterfaceTypeList, IList`1 contextList)
at VMware.VimAutomation.Sdk.Impl.V1.CoreServiceImpl.GetObn(IList`1 connectionIdList, IList`1
objectNameList, IList`1 objectInterfaceTypeList, IList`1 contextList, String contextRelationName)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.GetObjectsByNameCore(PropertyInfo
parameter, String objectName)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectByNameCore(PropertyInfo
parameter, String objectName)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectByName(PropertyInfo
parameter)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ObnSelector.SelectObjectsByName()
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.SelectObjectsByName()
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
HelpLink :
Source : mscorlib
HResult : -2147467261

Script 7.0.0.1... VMware.Vim
Script 12.0.0.... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 12.0.0.... VMware.VimAutomation.Common {Get-Task, New-OAuthSecurityContext, Stop-Task, Wait-Task}
Script 12.0.0.... VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...
Script 12.0.0.... VMware.VimAutomation.Sdk {Get-ErrorReport, Get-InstallPath, Get-PSVersion}
Script 12.0.0.... VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...

I thought it was due to originally using PowerCLI of 6.5.1 as script was working and was working a couple of months ago but then vCenter had been upgraded in that time.

 

 

 

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

Is port TCP/7444 open between your station and the PSC (or the VCSA if using an embedded PSC)?
Did you set the PowerCLIConfiguration option InvalidCertificateAction to Ignore?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
knikolov
VMware Employee
VMware Employee

What if you try:

$tag = Get-Tag PC3_DEPLOY
Get-Datastore -Tag $tag

Reply
0 Kudos