VMware Cloud Community
lurims
Enthusiast
Enthusiast
Jump to solution

How to list all Distributed Switches of a vCenter

I do not find something like VcPlugin.getAllDistributedVirtualSwitches like we have for many other objects like VcPlugin.getAllSDKConnections().  Could you one help to list and play around an array of Distributed Virtual Switches?

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Check the following code:

var allDVS = Server.findAllForType("VC:DistributedVirtualSwitch");

for each (var dvs in allDVS) {

  System.log(dvs);

}

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Check the following code:

var allDVS = Server.findAllForType("VC:DistributedVirtualSwitch");

for each (var dvs in allDVS) {

  System.log(dvs);

}

0 Kudos
lurims
Enthusiast
Enthusiast
Jump to solution

Thanks llian, I almost forgot about findAllForType.  Can I get it by a vCenter (SDKConnection)?  Also how to filter the Distributed Virtual Port groups based on filter for the object in the picture?  Could you throw an example?  Is it an xpath query?

0 Kudos