12 Replies Latest reply on May 16, 2019 11:42 PM by LucD

    some powercli commands like get-tag gets error

    Fintek Lurker

      Some powercli commands like "get-tag" or "Get-ContentLibraryItem" gets error on my environments. I have tried these commands on different computers, vcenters and powerclis but situation is still same. Is there anybody faced with same issue? What is the solution

       

      Error:

      Get-Tag : 21.12.2017 11:39:28    Get-Tag        Failed to obtain the registration record for the VC 'VC_FQDN' from the vSphere lookup service   

      At line:1 char:1

      + Get-Tag

      + ~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [Get-Tag], CisException

          + FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Impl.V1.Service.Tagging.Cis.TaggingServiceCisImpl.GetTag.Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.Tagging.GetTag

       

      Environment details:

      vCenter 1: 6.5.0 Build 5973321

      vCenter 2: 6.0.0 Build 5318203

       

      PowerCLI 1:

      Name                                Version     

      ----                                -------     

      VMware.DeployAutomation             6.5.1.6997673

      VMware.ImageBuilder                 6.5.1.6997673

      VMware.PowerCLI                     6.5.4.7155375

      VMware.VimAutomation.Cis.Core       6.5.4.6983166

      VMware.VimAutomation.Cloud          6.5.1.5375799

      VMware.VimAutomation.Common         6.5.4.6979861

      VMware.VimAutomation.Core           6.5.2.6234650

      VMware.VimAutomation.HA             6.5.4.7147627

      VMware.VimAutomation.HorizonView    7.1.0.5307191

      VMware.VimAutomation.License        6.5.1.5375648

      VMware.VimAutomation.Nsxt           2.0.0.6870461

      VMware.VimAutomation.PCloud         6.5.1.5376282

      VMware.VimAutomation.Sdk            1.0.0.5334677

      VMware.VimAutomation.Srm            6.5.1.5374694

      VMware.VimAutomation.Storage        6.5.4.7154886

      VMware.VimAutomation.StorageUtility 1.1         

      VMware.VimAutomation.Vds            6.5.1.5374428

      VMware.VimAutomation.Vmc            6.5.4.7086404

      VMware.VimAutomation.vROps          6.5.1.5375723

      VMware.VumAutomation                6.5.1.5301639

       

      PowerCLI 2:

      Name                                                                                                 Version                                                                                            

      ----                                                                                                 -------                                                                                            

      VMware.DeployAutomation                                                                              6.0.0.0                                                                                            

      VMware.ImageBuilder                                                                                  6.0.0.0                                                                                            

      VMware.VimAutomation.Cis.Core                                                                        6.5.0.4624453                                                                                      

      VMware.VimAutomation.Cloud                                                                           6.5.0.4624821                                                                                      

      VMware.VimAutomation.Common                                                                          6.5.0.4624451                                                                                      

      VMware.VimAutomation.Core                                                                            6.5.0.2604913                                                                                      

      VMware.VimAutomation.HA                                                                              6.0.0.0                                                                                            

      VMware.VimAutomation.HorizonView                                                                     7.0.2.4596620                                                                                      

      VMware.VimAutomation.License                                                                         6.5.0.4624822                                                                                      

      VMware.VimAutomation.PCloud                                                                          6.5.0.4624825                                                                                      

      VMware.VimAutomation.Sdk                                                                             6.5.0.4624452                                                                                      

      VMware.VimAutomation.Storage                                                                         6.5.0.4624820                                                                                      

      VMware.VimAutomation.Vds                                                                             6.5.0.4624695                                                                                      

      VMware.VimAutomation.vROps                                                                           6.5.0.4624824                                                                                      

      VMware.VumAutomation                                                                                 6.0.0.0       

        • 1. Re: some powercli commands like get-tag gets error
          LucD Guru
          User ModeratorsvExpertCommunity Warriors

          Did you connect to the vCenter with the FQDN of the vCenter?

          Is the hostname of the vCenter resolvable by DNS (short/FQDN, forward/reverse lookup)?

          • 2. Re: some powercli commands like get-tag gets error
            Fintek Lurker

            Yeap I have connected with fqdn of vCenter. Forward/reverse lookup can be resolved on both vCenter appliance and powercli host machines.

            • 3. Re: some powercli commands like get-tag gets error
              LucD Guru
              vExpertCommunity WarriorsUser Moderators

              I would be interested to know if access to the tag via the REST API also has issues.

              Can you eventually try the rCisTag module I published?

              1 person found this helpful
              • 4. Re: some powercli commands like get-tag gets error
                Fintek Lurker

                I imported rCisTag and called it but it got error below.

                 

                PS C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master> Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd

                 

                PS C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master> Get-rCisTag

                Get-rCisTagCategory : Cannot bind argument to parameter 'Id' because it is null.

                At C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master\Modules\rCisTag\rCISTag.psm1:253 char:57

                + ...   Category = (Get-rCisTagCategory -Id $result.value.category_id).Name

                +                                           ~~~~~~~~~~~~~~~~~~~~~~~~~

                    + CategoryInfo          : InvalidData: (:) [Get-rCisTagCategory], ParameterBindingValidationException

                    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Get-rCisTagCategory

                 

                PS C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master> Get-rCisTagCategory

                You cannot call a method on a null-valued expression.

                At C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master\Modules\rCisTag\rCISTag.psm1:311 char:17

                +                 $out += New-Object PSObject -Property @{

                +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

                    + FullyQualifiedErrorId : InvokeMethodOnNull

                • 5. Re: some powercli commands like get-tag gets error
                  LucD Guru
                  User ModeratorsCommunity WarriorsvExpert

                  Is that against the vSphere 6.5U1 vCenter?

                  • 7. Re: some powercli commands like get-tag gets error
                    LucD Guru
                    vExpertCommunity WarriorsUser Moderators

                    And what is returned when you go via the CisService cmdlet?

                     

                    Connect-CisServer -Server $cisServer -User $cisUser -Password $cisPswd

                     

                    $tag = Get-CisService -Name 'com.vmware.cis.tagging.tag'

                    $tag.list() | %{

                        $tag.get($_)

                    }

                    Disconnect-CisServer -Server $cisServer -Confirm:$false

                    1 person found this helpful
                    • 8. Re: some powercli commands like get-tag gets error
                      Fintek Lurker

                      I think there was an error on importing your module. I reimported module and tested again. It looks fine. But why vmware modules not working? Do you have an any idea?

                       

                      PS C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master\Modules> Connect-rCisServer -Server $cisServer -User $cisUser -Password $cisPswd

                      PS C:\Users\bkurt\Desktop\TEMP\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master\Modules> Get-rCisTag

                       

                      Category    : ROLE

                      Description :

                      Id          : urn:vmomi:InventoryServiceTag:3ad5aff9-b129-441a-9d5c-ca88907513a1:GLOBAL

                      Name        : db

                      Uid         : Tag=urn:vmomi:InventoryServiceTag:3ad5aff9-b129-441a-9d5c-ca88907513a1:GLOBAL/

                      Client      :

                       

                       

                      Category    : SERVICE

                      Description :

                      Id          : urn:vmomi:InventoryServiceTag:71f48deb-fb3e-49be-a4dd-18bdd7427fb4:GLOBAL

                      Name        : telbank

                      Uid         : Tag=urn:vmomi:InventoryServiceTag:71f48deb-fb3e-49be-a4dd-18bdd7427fb4:GLOBAL/

                      Client      :

                       

                      ....

                      ....

                      ..

                      • 9. Re: some powercli commands like get-tag gets error
                        LucD Guru
                        vExpertCommunity WarriorsUser Moderators

                        Not really I'm afraid.

                         

                        You probably tried all the obvious like stop/start your PowerShell session, reboot the station (not sure if that has any impact), reinstall PowerCLI modules...

                         

                        Since the REST API seem to be returning the Tags ok, that seems to indicate that the Tag Service is working ok.

                         

                        So it looks indeed as if the PowerCLI cmdlets might have an issue in your environment (for me they seem to be working).

                        I would suggest to open a SR for this, it looks like a "feature".

                        1 person found this helpful
                        • 10. Re: some powercli commands like get-tag gets error
                          Fintek Lurker

                          Although I have tried on two host (win2012 and win2016), it doesn't work for me. But I'll try it again regarding your instructions.

                           

                          Thank you so much.

                          • 11. Re: some powercli commands like get-tag gets error
                            nsomani Novice

                            Hi LUCD, I aa getting the same error when I run the powercli command : New-TagCategory.Interesting thing here is this is extremely intermittent. When I ran the command manually agin and not oart of a test suite is passed. I was curious to know how we can make sure not to face this error even intermittently?

                            • 12. Re: some powercli commands like get-tag gets error
                              LucD Guru
                              User ModeratorsvExpertCommunity Warriors

                              Which PowerCLI version are you using?
                              The more recent releases contain a number of fixes for issues with Tag-related cmdlets.

                               

                              As an alternative, you could also check if the REST-based methods eliminate this issue.

                              You can give the latest available module in the PowerCLI Examples repo a go.

                              See New Community Module for Tag Management