VMware Cloud Community
Developer_PK
Enthusiast
Enthusiast

Fectch the tags in a server in using shell scripting

Hi,

I want to write a script to fetch the tags present in each server in OCI

Any suggestion Helps!

Thanks!

Tags (3)
0 Kudos
3 Replies
LucD
Leadership
Leadership

What do you mean by "servers", are these ESXi nodes or VMs?
Does OCI stand for Oracle Cloud Infrastructure?


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

0 Kudos
Developer_PK
Enthusiast
Enthusiast

Yes @LucD 
They are vms and it is oracle cloud infrastructure 

0 Kudos
LucD
Leadership
Leadership

Does the following produce what you want to see?

Get-VM -PipelineVariable vm |
Get-TagAssignment |
Select @{N='VM';E={$vm.Name}},
   @{N='Tag';E={$_.Tag.Name}},
   @{N='Category';E={$_.Tag.Category.Name}}


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

0 Kudos