VMware {code} Community
looc
Contributor
Contributor

Get machines on a datastore , vb.net

Hi

I´m trying to get all machines using a specific datastore, using  Vmware.Vim

Problem is that i cant filter on datastore-name, how?????

My idea was to step thru datastores and then get machines that have that datastore

I´m trying to list the machines with the following, but filter is not working, and i have tried some other combinations..

Dim

vc = New VimClient()

vc.Connect("https://x/sdk")

vc.Login("x", "x")

Dim filter As NameValueCollection = New NameValueCollection()

filter.Add("Datastore", "datastore-27422")

Dim hostLst As List(Of EntityViewBase) = vc.FindEntityViews(GetType(VirtualMachine), Nothing, filter, Nothing)

For Each host As VirtualMachine In hostLst

Console.WriteLine(host.Name)

Next

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership

I moved this discussion to the vSphere Web Services SDK forum.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos