VMware Cloud Community
jimrPiq
Contributor
Contributor
Jump to solution

Get-VM -Tag array syntax not working.

this is PowerCLI on CentOS

for example:

Get-VM -Tag Prod-A3,SSD-6A,SSD-A3

errors with the following when these additional tags absolutely exist.

It does display the results for the first tag though.

Any ideas on how to work around this?

PS /home/jrichard> Get-Tag Prod-*,SSD*

Name                           Category                       Description

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

SSD-A3                         datastore assignment          

SSD-6A                         datastore assignment          

Prod-A3                        datastore assignment          

PS /home/jrichard> Get-VM -Tag Prod-A3,SSD-6A      

Get-VM : 1/9/20 3:39:35 PM      Get-VM          Could not find Tag with name 'SSD-6A'.

At line:1 char:1

+ Get-VM -Tag Prod-A3,SSD-6A

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

+ CategoryInfo          : ObjectNotFound: (SSD-6A:String) [Get-VM], VimException

+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

PowerCLI Version

VMware PowerCLI 11.5.0 build 14912921

VMware Common PowerCLI Component 11.5 build 14898112

VMware Cis Core PowerCLI Component PowerCLI Component 11.5 build 14898113

VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.5 build 14899560

PowerCLI Version----------------   VMware PowerCLI 11.5.0 build 14912921---------------Component Versions---------------   VMware Common PowerCLI Component 11.5 build 14898112   VMware Cis Core PowerCLI Component PowerCLI Component 11.5 build 14898113   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.5 build 14899560

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

There seems to be an issue with Tags and OBN.

On this I get the same error as you.

Get-VM -Tag Tag1,Tag2


While this works correctly

Get-VM -Tag (Get-Tag -Name Tag1,Tag2)

I suggest you use the bypass for now and in parallel open a SR


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

There seems to be an issue with Tags and OBN.

On this I get the same error as you.

Get-VM -Tag Tag1,Tag2


While this works correctly

Get-VM -Tag (Get-Tag -Name Tag1,Tag2)

I suggest you use the bypass for now and in parallel open a SR


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

0 Kudos
jimrPiq
Contributor
Contributor
Jump to solution

Ya, confirmed the same error happens in a native Windows environment, it's not just some quirky behavior with the Linux shell as I had originally suspected.

Thanks for the help Smiley Happy

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I passed this thread on to one of the PowerCLI Team people.
They should be aware of the issue now


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

0 Kudos