Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 193198

Having trouble retrieving tags from vCenter VMWare virtual machine on .NET

$
0
0

Hello, I am trying to retrieve the tags from each of the virtual machines on vCenter for a project I am writing for the company I work for. I succesfully have set up the .NET environment with PowerCLI and I can successfully retrieve all VM with name and such, but when I try to get the tags, I get an empty array.

 

// Connect to VMware SDK service

Client.Connect(address_vmw);

Client.Login(username_vmw, password_vmw);

 

// Get all Virtual Machines

vmw_machines = Client.FindEntityViews(typeof(VirtualMachine), null, null, null);

 

foreach (VirtualMachine machine in vmw_machines) //for each machine in VMW

{

string machineName = machine.Name; // this works fine

dynamic client = machine.Tag; // I need to fix this line!

 

foreach (dynamic tag in machineTags) // it is an empty array!

{

   Console.Write(tag);

}

 

...

 

This are the tags I need to retrieve on vCenter:

tags.jpeg


Viewing all articles
Browse latest Browse all 193198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>