VMware Cloud Community
MichaelLeone
Enthusiast
Enthusiast

Errors retrieving tags using PowerCLI 11.4 from vCenter 7.03

I am trying to retrieve tags using PowerCLI 11.4 from a vCenter 7.0.3. I thought this was supported:

> Connect-VIServer <vCenter> -User <User@domain> -Password <password>

> Get-VM -Name D<My-VM-Name>  |Get-TagAssignment
Get-TagAssignment : 9/14/2023 1:01:31 PM Get-TagAssignment com.vmware.vapi.std.errors.operation_not_found {'messages': [com.vmware.vapi.std.localizable_message
{'id': vapi.method.input.invalid.interface, 'default_message': Cannot find service 'com.vmware.cis.data.svc.resource_model'., 'args':
[com.vmware.cis.data.svc.resource_model]}], 'data':}
At line:1 char:26
+ Get-VM -Name DCTRMAN028 |Get-TagAssignment
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-TagAssignment], CisException
+ FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Impl.V1.Service.Tagging.Cis.TaggingServiceCisImpl.GetTagAssignment.Error,VMware.VimAutomation.ViCore.Cmdl
ets.Commands.Tagging.GetTagAssignment

 

I realize I'm a bit behind on my PowerCLI version, but updating it isn't working for me:

PS C:\WINDOWS\system32> update-module VMware.PowerCLI

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository
cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PackageManagement\Install-Package : Authenticode issuer 'System.Object[]' of the new module 'VMware.VimAutomation.Sdk' with version '13.1.0.21605170' is not
matching with the authenticode issuer 'CN=VeriSign Class 3 Public Primary Certification Authority - G5, OU="(c) 2006 VeriSign, Inc. - For authorized use only",
OU=VeriSign Trust Network, O="VeriSign, Inc.", C=US' of the previously-installed module 'VMware.VimAutomation.Sdk' with version '11.3.0.13964823'. If you still
want to install or update, use -SkipPublisherCheck parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 char:20
+ ... $sid = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : AuthenticodeIssuerMismatch,Validate-ModuleAuthenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Does this command work in PowerCLI 11.4 on vCenter 7.0.3?

 

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

Are all services on the VCSA running and healthy?
Can you eventually restart your VCSA?

The install issue is due to an older version of the PowerShellGet module.
Try upgrading that first with

Install-PackageProvider -Name Nuget –Force
Install-Module –Name PowerShellGet –Force


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

Reply
0 Kudos
MichaelLeone
Enthusiast
Enthusiast

AH HA! I updated my PowerCLI (boy, did THAT take a long time ....), and now accessing the tags seem to work:

(much snippage)

> get-module | select Name,version

Name Version
---- -------
vmware.powercli 13.1.0.21624340

> Connect-VIServer <vCenter> -User <user@domain> -Password <password>

Name Port User
---- ---- ----
<vCenter> 443 <domain\user>


> Get-VM -Name DCTRMAN028 |Get-TagAssignment

Tag Entity
--- ------
PROD/PROD DCTRMAN028
PROD/Network Management DCTRMAN028

So what I need to do now is update the PowerCLI on the script host which runs all of our scheduled task scripts. That host is not connected to the internet (most servers are not, for security reasons). So now I have to do an offline upgrade of PowerCLI. I hope it goes well, I have other regularly scheduled scripts that need to be able to run (reporting on snapshots, monthly saving of ESXi configurations, etc). Hopefully that will go smoothly ...

Thanks! Seems to be have been an issue with PowerCLI 11.4. The latest 13.1 Just Works ....

Reply
0 Kudos