VMware Cloud Community
smathijssen
Contributor
Contributor

get-vm -tag gives a timeout with newer versions of PowerCLI

We use get-vm -tag <tagname> a lot with the Powershell Powercli module, but as of late we found out that it gives a timeout on some machines.

I have tried the latest powerclicore container (to rule out incompatibilities with older module versions) but that does also give a timeout.

Machines with older versions of the module (6.5) can still use this functionality.

I tried downgrading to 6.5, but on my machine it still gives a timeout.

Ideally I would start using PowerCLIcore so we can containerize our scripts (always the right version for the scripts) so my question is:

Has someone seen this working on the newer versions of PowerCLI (or knows what could be the problem)

Version 11 and 6.5 do not seem to work when downloaded with install-module

Best regards,

Sander

VMware ESXi, 6.5.0, 8294253

Vcenter 6.5.0 7312210

0 Kudos
9 Replies
LucD
Leadership
Leadership

Can you provide a bit more info on what you are using?

PowerShell version, PowerCLI version, vSphere version?
And on which platform are you running PSCore?


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

0 Kudos
smathijssen
Contributor
Contributor

Hi Luc,

Nice to talk to you again.

Yeah, I've added the version info in the post (totally forgot that).

I'm running powercli on Windows 10, with powershell 5.1

Get-Module *vmware* -ListAvailable | select name, version

Name                                Version

----                                -------

VMware.DeployAutomation             6.7.0.8250345

VMware.ImageBuilder                 6.7.0.8250345

VMware.PowerCLI                     11.0.0.10380590

VMware.Vim                          6.7.0.10334489

VMware.VimAutomation.Cis.Core       11.0.0.10335701

VMware.VimAutomation.Cloud          11.0.0.10379994

VMware.VimAutomation.Common         11.0.0.10334497

VMware.VimAutomation.Core           11.0.0.10336080

VMware.VimAutomation.HorizonView    7.6.0.10230451

VMware.VimAutomation.License        10.0.0.7893904

VMware.VimAutomation.Nsxt           11.0.0.10364044

VMware.VimAutomation.Sdk            11.0.0.10334495

VMware.VimAutomation.Security       11.0.0.10380515

VMware.VimAutomation.Srm            10.0.0.7893900

VMware.VimAutomation.Storage        11.0.0.10380343

VMware.VimAutomation.StorageUtility 1.3.0.0

VMware.VimAutomation.Vds            11.0.0.10336077

VMware.VimAutomation.Vmc            11.0.0.10336076

VMware.VimAutomation.vROps          10.0.0.7893921

VMware.VumAutomation                6.5.1.7862888

I've also tested the Powerclicore container on linux.

0 Kudos
smathijssen
Contributor
Contributor

Okay,

I've tested this to another Vcenter and there it does work...

That runs Vcenter 6.7.0 8170161

VMware ESXi, 6.7.0, 8169922

0 Kudos
LucD
Leadership
Leadership

Just tried it with same versions you have running, but I can't reproduce the issue you are seeing.
Do you get the timeout with this type of line (replace with one of your tags of course)?

Get-VM -Tag MyTag

Do you get the same errors when you just do

Get-TagAssignment

And what is the exact error you are getting?


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

0 Kudos
LucD
Leadership
Leadership

I saw a report on hang of the Tag cmdlets last year.
There the issue was solved by doing the Connect-VIServer with the FQDN of the vCenter.


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

0 Kudos
smathijssen
Contributor
Contributor

Sight,

A colleague logged in on my machine, and now it does not time out (he has less permissions in vsphere).

It seems that the command is so slow that it times out. Used to be lightning fast.

We tried the same using govmomi (govc) and there it is done in a breeze.

I'll look into the differences between what the posh modules do, and what govc does.

Thnx for helping!

0 Kudos
VSnip
Enthusiast
Enthusiast

Hi LucD​,

I've got the same issue when I try with FQDN. 😕

I've a script that removes snapshots that we filter on a specific Tag.

I don't know why it doesn't work anymore. No PowerCLI update...

PS C:\Program Files\SAPIEN Technologies, Inc\PrimalScript 2019> get-vm -tag "Snap_3d"                                                                              

get-vm : 29/04/2019 11:34:23    Get-VM          A task was canceled.                                                                                               

At line:1 char:1                                                                                                                                                   

+ get-vm -tag "Snap_3d"                                                                                                                                            

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

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

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

My original PowerCLI command:

Get-VM -Tag "Snap_3d" | Get-Snapshot | Where-Object {$_.Created -lt (Get-Date).AddDays(-4)} | Sort-Object VM | select VM, Name, Created , @{N="SizeMB";E={[math]::Round($_.SizeMB,2)}}

PowerCLI version:

PowerCLI Version                                                                               

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

   VMware PowerCLI 10.0.0 build 7895300                                                        

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

Component Versions                                                                             

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

   VMware Cis Core PowerCLI Component PowerCLI Component 10.0 build 7893915                    

   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.0 build 7893909

Modules Version:

Name                                Version       

----                                -------       

VMware.DeployAutomation             6.5.2.7812840 

VMware.ImageBuilder                 6.5.2.7812840 

VMware.PowerCLI                     10.0.0.7895300

VMware.VimAutomation.Cis.Core       10.0.0.7893915

VMware.VimAutomation.Cloud          10.0.0.7893901

VMware.VimAutomation.Common         10.0.0.7893906

VMware.VimAutomation.Core           10.0.0.7893909

VMware.VimAutomation.HA             6.5.4.7567193 

VMware.VimAutomation.HorizonView    7.1.0.7547311 

VMware.VimAutomation.License        10.0.0.7893904

VMware.VimAutomation.Nsxt           10.0.0.7893913

VMware.VimAutomation.PCloud         10.0.0.7893924

VMware.VimAutomation.Sdk            10.0.0.7893910

VMware.VimAutomation.Srm            10.0.0.7893900

VMware.VimAutomation.Storage        10.0.0.7894167

VMware.VimAutomation.StorageUtility 1.2.0.0       

VMware.VimAutomation.Vds            10.0.0.7893903

VMware.VimAutomation.Vmc            10.0.0.7893902

VMware.VimAutomation.vROps          10.0.0.7893921

VMware.VumAutomation                6.5.1.7862888 

VMware.DeployAutomation             6.5.2.7812840 

VMware.ImageBuilder                 6.5.2.7812840 

VMware.PowerCLI                     10.0.0.7895300

VMware.VimAutomation.Cis.Core       10.0.0.7893915

VMware.VimAutomation.Cloud          10.0.0.7893901

VMware.VimAutomation.Common         10.0.0.7893906

VMware.VimAutomation.Core           10.0.0.7893909

VMware.VimAutomation.HA             6.5.4.7567193 

VMware.VimAutomation.HorizonView    7.1.0.7547311 

VMware.VimAutomation.License        10.0.0.7893904

VMware.VimAutomation.Nsxt           10.0.0.7893913

VMware.VimAutomation.PCloud         10.0.0.7893924

VMware.VimAutomation.Sdk            10.0.0.7893910

VMware.VimAutomation.Srm            10.0.0.7893900

VMware.VimAutomation.Storage        10.0.0.7894167

VMware.VimAutomation.StorageUtility 1.2.0.0       

VMware.VimAutomation.Vds            10.0.0.7893903

VMware.VimAutomation.Vmc            10.0.0.7893902

VMware.VimAutomation.vROps          10.0.0.7893921

VMware.VumAutomation                6.5.1.7862888 

Powershell version:

Name                           Value                 

----                           -----                 

PSVersion                      5.1.14393.2828        

PSEdition                      Desktop               

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

BuildVersion                   10.0.14393.2828       

CLRVersion                     4.0.30319.42000       

WSManStackVersion              3.0                   

PSRemotingProtocolVersion      2.3                   

SerializationVersion           1.1.0.1               

If you have any clue to help me it will be great!

Thanks.

Kind Regards,

Stephane

0 Kudos
LucD
Leadership
Leadership

Are all services on the VCSA running correctly?


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

0 Kudos
VSnip
Enthusiast
Enthusiast

Yes all services running well.
All are in a Good state.

0 Kudos