1 2 Previous Next 28 Replies Latest reply on Dec 12, 2019 4:48 PM by kmruddyVMW

    Get-VM -Tag not working in VMware vSphere 6.7

    hideyori Novice

      Hello all

       

      In VMware vSphere 6.0 with PowerCLI version 11.2.0 we used Get-VM -Tag 'Test' to list

      VM with tag with value Test. After upgrade to VMware vSphere 6.7 this stopped working.

       

      Is there a solution for that?

       

      Regards

      Hideyori

        • 1. Re: Get-VM -Tag not working in VMware vSphere 6.7
          KocPawel Hot Shot

          I've found that on vmware sites:

           

          The following example returns all tags named “MyTag”.

          Get-Tag -Name MyTag

           

          The following example returns all tags from the “MyCategory1” and “MyCategory2” categories, named “MyTag”.

          Get-Tag -Category MyCategory1, MyCategory2 -Name MyTag

           

          Did you try your Get-VM -Tag 'Test' like: Get-VM -Tag Test

          ?

          • 2. Re: Get-VM -Tag not working in VMware vSphere 6.7
            hideyori Novice

            Hello

             

            Yes, I tried "Get-VM -Tag Test" but I get error:

             

            Value cannot be null

             

            Regards

            Hideyori

            • 3. Re: Get-VM -Tag not working in VMware vSphere 6.7
              KocPawel Hot Shot

              I tested it on my LAB but with newer PowerCLI version and it works.

               

              PS C:\Users\****\Documents\WindowsPowerShell> Get-PowerCLIVersion

              WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.

              PowerCLI Version

              ----------------

                 VMware PowerCLI 11.3.0 build 13990089

              ---------------

              Component Versions

              ---------------

                 VMware Cis Core PowerCLI Component PowerCLI Component 11.3 build 13964830

                 VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.3 build 13964826

               

              Next:

              Connect-VIServer <vCenter server name>

              Get-VM -Tag Test

               

              Could You check your CLI version and update to newest?

              • 4. Re: Get-VM -Tag not working in VMware vSphere 6.7
                hideyori Novice

                Thanks, I had 11.2.0. Have now updated to version 11.5.0 but still same result when execute:

                 

                Get-VM -Tag Test

                 

                > Value cannot be null

                 

                Regards

                Hideyori

                • 5. Re: Get-VM -Tag not working in VMware vSphere 6.7
                  KocPawel Hot Shot

                  Hmmm,

                  What about other options?

                  What happens if you try do only Get-VM or Get-VM -Name <vm name> ?

                  • 6. Re: Get-VM -Tag not working in VMware vSphere 6.7
                    hideyori Novice

                    This works without an issue.

                    • 7. Re: Get-VM -Tag not working in VMware vSphere 6.7
                      scott28tt Champion
                      Community WarriorsUser ModeratorsVMware Employees

                      Moderator note: Moved to PowerCLI

                      • 8. Re: Get-VM -Tag not working in VMware vSphere 6.7
                        LucD Guru
                        User ModeratorsvExpertCommunity Warriors

                        That was a known error in older PowerCLI versions.

                        But shouldn't be there anymore.

                         

                        Just tested , for me it works as expected

                        vmtag.png

                        Which PowerCLI modules do you have installed?
                        Can you show what the following returns?

                         

                        Get-Module -Name VMware* -ListAvailable


                        Since this issue was also seen occasionally with some corrupt PowerCLI installations, you could try to uninstall PowerCLI (just remove the folders) and after a restart, install PowerCLI again.

                        • 9. Re: Get-VM -Tag not working in VMware vSphere 6.7
                          hideyori Novice

                          Hi Luc

                           

                          I have tried with version 11.2.0 and then updated to 11.5.0 > same result. I have now uninstalled and

                          installed PowerCLI as you told > same problem (we are using newest version of vCenter Appliance 6.7.

                          build 41000 from 24october2019 ... maybe there is an issue again?):

                          -------------------------------------------------------------------

                          Directory: C:\Program Files\WindowsPowerShell\Modules

                           

                          ModuleType Version    Name                                ExportedCommands

                          ---------- -------    ----                                ----------------

                          Script     6.7.0.1... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...

                          Script     6.7.0.1... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...

                          Manifest   11.5.0.... VMware.PowerCLI

                          Script     6.7.0.1... VMware.Vim

                          Script     11.5.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}

                          Script     11.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...

                          Script     11.5.0.... VMware.VimAutomation.Common         {Get-Task, Stop-Task, Wait-Task}

                          Script     11.5.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...

                          Script     11.5.0.... VMware.VimAutomation.Hcx            {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance...

                          Script     7.10.0.... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}

                          Script     11.3.0.... VMware.VimAutomation.License        Get-LicenseDataManager

                          Script     11.5.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtPolicy...

                          Script     11.5.0.... VMware.VimAutomation.Sdk            Get-ErrorReport

                          Script     11.0.0.... VMware.VimAutomation.Security       {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpm...

                          Script     11.5.0.... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}

                          Script     11.5.0.... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Add-VsanObjectToRepairQueue, Cop...

                          Script     1.3.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore

                          Script     11.2.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...

                          Script     11.5.0.... VMware.VimAutomation.Vmc            {Add-VmcSddcHost, Connect-Vmc, Disconnect-Vmc, Get-AwsAcco...

                          Script     10.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...

                          Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...

                          -------------------------------------------------------------------

                           

                          Regards

                          Hideyori

                          • 10. Re: Get-VM -Tag not working in VMware vSphere 6.7
                            KocPawel Hot Shot

                            Hi,

                            I've upgraded vCenter to version as you have and command works, so it is not a problem with vCenter version.

                            • 11. Re: Get-VM -Tag not working in VMware vSphere 6.7
                              LucD Guru
                              Community WarriorsvExpertUser Moderators

                              No, the vCenter version should not make a difference.


                              Are you using an embedded or external PSC?
                              The known issue seems to have occurred more frequently with installations with an external PSC.

                               

                              I would also suggest opening an SR for this.

                              If GSS tells you PowerCLI is not supported, point them to PowerCLI Support Breakdown

                              • 12. Re: Get-VM -Tag not working in VMware vSphere 6.7
                                hideyori Novice

                                We are using the embedded PSC. I have opened a SR yesterday evening with VMware about this.

                                 

                                Thanks for all the help in the meantime.

                                • 13. Re: Get-VM -Tag not working in VMware vSphere 6.7
                                  LucD Guru
                                  Community WarriorsUser ModeratorsvExpert

                                  No problem.
                                  Can you check if the following work in your environment?

                                   

                                  Get-TagAssignment

                                  Get-TagAssignment -Entity <name-of-a-vm-with-a-tag>

                                  • 14. Re: Get-VM -Tag not working in VMware vSphere 6.7
                                    hideyori Novice

                                    This also fails with: "vSphere single sign-on failed for connection during a previous operation"

                                    1 2 Previous Next