We recently started running into an issue in one of our vCenters with a script that I had written to grab the inventory of VMs in our environment including the Tags associated with the VMs. We have 3 vCenters, all running 6.5, and 2 of the 3 vCenters run the script fine, but when we run the script against the 3rd vCenter, we get an error:
Get-TagAssignment : 5/14/2018 4:40:31 PM Get-TagAssignment com.vmware.vapi.std.errors.internal_server_error {'messages': [com.vmware.vapi.std.localizable_message {'id':
vapi.bindings.method.impl.unexpected, 'default_message': Provider method implementation threw unexpected exception: Read timed out, 'args': [Read timed out]}], 'data':}
At line:1 char:1
+ Get-TagAssignment
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-TagAssignment], CisException
+ FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Impl.V1.Service.Tagging.Cis.TaggingServiceCisImpl.GetTagAssignment.Error,VMware.VimAutomation.ViCore.Cmdlets.Comma
nds.Tagging.GetTagAssignment
The vCenter with the issues is our largest site, and has the most tags, so I believe we have possibly hit a limit of the number of results get-tagassignment can return as this script worked fine until a week ago when we added some more tags to the VMs.
I have looked at a few other threads on here, and in one of them LucD recommended using his rCIS module to get around a very similar issue. I have attempted to run the rCIS module and am getting an error with it as well:
Get-View : 5/14/2018 4:39:19 PM Get-View You are not currently connected to any servers. Please connect first using a Connect cmdlet.
At FileLocation\Projects\VMWare\rCisTag\rCisTag.psm1:408 char:35
+ ... Entity = (Get-View -id $sMoRef -Property Name).Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-View], ViServerConnectionException
+ FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
I have verified that both get-tag and get-rcistag works fine, and using either get-tagassigment or get-rcistagassignment using the -entity filter works, but using either without a filter fails. unfortunately due to the way the code was written, using a filter on the get-tagassignment isnt easy to re-write
Below is the section of code that is calling the get-tagassignment and failing
foreach($tag in (Get-TagAssignment)){
$tagCat += $tag.Tag.Category.Name
$key = $tag.Entity.Name
if($tagTab.ContainsKey($key)){
` $val = $tagTab.Item($key)
}
else{
$val = @{}
}
$val.Add($tag.Tag.Category.Name,$tag.Tag.Name)
$tagTab[$key] = $val
}
any assistance would be greatly appreciated