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: