Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

Retrieving list of VM names using FindItems

$
0
0

Hi,

 

I'm trying to retrieve a list of virtual machine names on a host using finditems. I have been able to retrieve a list of VMX file paths using VIX_PROPERTY_FOUND_ITEM_LOCATION. I am using VMWare Server 2.0 with VIX 1.1.6 in VBScript.

 

The code I am using is as follows :

 

                               Set oJob = oHost.FindItems(VixCOM.Constants.VIX_FIND_REGISTERED_VMS, Nothing, -1, Nothing)

          iErr = oJob.WaitWithoutResults()

           

          If Not oVMWare.ErrorIndicatesFailure(iErr) Then

               iNumResults = oJob.GetNumProperties(VixCOM.ConstantsVIX_PROPERTY_FOUND_ITEM_LOCATION.)

               For iCount = 0 To iNumResults - 1

                    iErr = oJob.GetNthProperties(iCount, Array(VixCOM.Constants.VIX_PROPERTY_FOUND_ITEM_LOCATION), _

                                        aResults)

                    If oVMWare.ErrorIndicatesFailure(iErr) Then

                         WScript.Echo "Error"

                    Else

                         WScript.Echo "Results: " & aResults(0)

                    End If

               Next

          Else

               WScript.Echo "Error " & oVMWare.GetErrorText(iErr,Empty)

          End If

 

Thanks for any help you can give.


Viewing all articles
Browse latest Browse all 34639

Trending Articles



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