VMware Cloud Community
DarrenPenner
Enthusiast
Enthusiast
Jump to solution

Unable to use tags in PowerCli 6.3 on Windows 10

So I am reading this post http://blogs.vmware.com/PowerCLI/2013/12/using-tags-with-powercli.html

because there are a few things I want to start using tags for.

We're running vCenter 6.0 and ESXi 6.0.

When I run get-tag I get an error

Get-Tag : 4/19/2016 9:01:23 AM Get-Tag Index was outside the bounds of the array. At line:1 char:1 + Get-Tag -Name "Operations" + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-Tag], VimException + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio n.ViCore.Cmdlets.Commands.Tagging.GetTag

When I run

get-vm -tag Operations

I get

get-vm : 4/19/2016 8:28:58 AM Get-VM Value cannot be null. Parameter name: collection
At line:1 char:1 + get-vm -Tag Operations + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-VM], VimException + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

For OS I am running Windows 10, Powershell 5 and PowerCLI 6.3.8258

There is a tag called Operations and a category called Operations VMs in vCenter.

This issue occurs if I am running Powershell with the PowerCli modules added to it or if I launch PowerCLI itself.

I have tried googling the errors with both powershell and powercli in the query but end up getting back long functions or scripts that are building large arrays or resource issues which my machine isn't having an issue with.

If I run the same command on the Windows vCenter server I get the exact same error.


There is a VM that exists on the target vCenter with the "Operations" tag.

Any suggestions on how to troubleshoot or approach this?

36 Replies
alexfertmann
Contributor
Contributor
Jump to solution

Is there any movement on this?  I'm running into the same issue when get just running get-vm and get-vmguest.  I'm on 2008 R2.

0 Kudos
stephenrbarry
Enthusiast
Enthusiast
Jump to solution

Are you using the "tag" parameter in your get-vm and get-vmguest cmdlets?  If so, it may be the same issue, but if not it's probably a different issue that you should open an SR with VMware for.

0 Kudos
stephenrbarry
Enthusiast
Enthusiast
Jump to solution

Anyone had any luck with this one besides disabling the SRM tagging?

0 Kudos
flynmooney
Enthusiast
Enthusiast
Jump to solution

We're seeing the same error here since December of last year.  We opened a ticket and were also told SDK to get help.  Going to try opening another ticket with VMware on this.

0 Kudos
stephenrbarry
Enthusiast
Enthusiast
Jump to solution

Yeah please do.  VMware support has confirmed it's a bug and they said it will be resolved in the next release of vSphere but that's a long time to wait and I'm pushing for some kind of workaround/hotfix.

0 Kudos
DarrenPenner
Enthusiast
Enthusiast
Jump to solution

I didn't even get that from them, did they confirm in an email or just over the phone that the next release would have a fix?

0 Kudos
stephenrbarry
Enthusiast
Enthusiast
Jump to solution

It was said to me via email.

0 Kudos
Andre_vd_Lingen
Contributor
Contributor
Jump to solution

We also have a SRM implementation and the same error occurs when using the get-tag cmdlet.

get-tag -name *

get-tag : 10-6-2016 14:48:03 Get-Tag Index was outside the bounds of the array. 

At line:1 char:1

+ get-tag -name *

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

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

  + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Tagging.GetTag

I don't know if it is of any help, but I stumbled on this work-around to get all the tags:

get-tag -name * -Category *

You can also put this into an array and than you can do anything with the aquired tag data.

Hope this helps you in the meantime.

0 Kudos
DarrenPenner
Enthusiast
Enthusiast
Jump to solution

That makes sense since what is happening when you send the get-tag commandlet a number of the category IDs are blank.

0 Kudos
stephenrbarry
Enthusiast
Enthusiast
Jump to solution

Yeah I'm also able to pull specific tags using get-tag and load them into a variable.  But where I run into trouble is using something like get-cluster with the -tag parameter. That one fails every time with the "index out of bounds " error, which makes scripting calling tagged objects impossible  

0 Kudos
austinb324
Enthusiast
Enthusiast
Jump to solution

You say they got it to work? What did they do?

I have 4 vcenters all with SRM (tagging enabled). 2 vCenters are Windows based and 2 are VCSAs. 1 of the VCSAs has this issue for me.

0 Kudos
thomsonac
Contributor
Contributor
Jump to solution

We have 3 brand-new VCSA 6.0u2 instances in the same SSO domain.  Previously running any interation of get-tag, get-tag -name <namegoeshere>, etc worked.  Unfortunately, randomly, it seems to have stopped working.  The tags worked both before and after SRM was installed.

0 Kudos
McBobby
Contributor
Contributor
Jump to solution

Did anyone ever get a resolution to this problem? I've got a fresh install of 6 update 2 on two linked vCenters with SRM. I can run Get-Tag and Get-VM -Tag on the production VC, but get the same error everyone else is experiencing when I run the same commands on the DR VC.

0 Kudos
thomsonac
Contributor
Contributor
Jump to solution

We still have occasional issues but by looking up each tag and setting each tag with the "-server" parameter seems to have drastically cut-down on the problems.  I still consider it a bug though

0 Kudos
stephenrbarry
Enthusiast
Enthusiast
Jump to solution

It looks like the issues with get-tag and SRM were resolved in PowerCLI 6.5 R1.  So far, my brief testing has had positive results.  I'd be curious to hear if it resolves everyone else's issues as well.

0 Kudos
DarrenPenner
Enthusiast
Enthusiast
Jump to solution

I can confirm from my end this has been resolved in 6.5.

Funny thing is my support engineer had no idea and development never came back with a fix, so maybe it just got fixed by accident?

Meh.... It works now.

0 Kudos
McBobby
Contributor
Contributor
Jump to solution

Thanks guys! I can confirm that it works for me as well. 

0 Kudos