
# main host vc7.0
vc="192.168-vc-ip"
u="vc-user"
p="vc-password"


curl -k -c /tmp/vm_cookie --location --request POST 'https://'$vc'/sdk/vimService.wsdl' \
--header 'Content-Type: application/xml' \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Login>
         <urn:_this type="SessionManager">SessionManager</urn:_this>
         <urn:userName>'$u'</urn:userName>
         <urn:password>'$p'</urn:password>
      </urn:Login>
   </soapenv:Body>
</soapenv:Envelope>' \
> /dev/null


hid=44175

curl -k -b /tmp/vm_cookie --location --request POST 'https://'$vc'/sdk/vimService' \
--header 'Accept-Encoding: gzip,deflate' \
--header 'Content-Type: text/xml;charset=UTF-8' \
--header 'SOAPAction: "urn:vim25/6.0"' \
-d '<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:vim25"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:RetrieveProperties>
         <urn:_this type="PropertyCollector">propertyCollector</urn:_this>
         <urn:specSet>
            <urn:propSet>
               <urn:type>HostSystem</urn:type>
               <urn:pathSet>name</urn:pathSet>
               <!-- urn:pathSet>summary</urn:pathSet>
               <urn:pathSet>parent</urn:pathSet>
               <urn:pathSet>datastore</urn:pathSet -->
               <urn:pathSet>config.virtualNicManagerInfo.netConfig</urn:pathSet>
               <urn:pathSet>summary.runtime.networkRuntimeInfo.netStackInstanceRuntimeInfo</urn:pathSet>
            </urn:propSet>
            <!-- urn:propSet>
               <urn:type>Datastore</urn:type>
               <urn:pathSet>host["host-'$hid'"].mountInfo.mounted</urn:pathSet>
               <urn:pathSet>host["host-'$hid'"].mountInfo.accessible</urn:pathSet>
               <urn:pathSet>host["host-'$hid'"].mountInfo.accessMode</urn:pathSet>
            </urn:propSet -->
            <urn:objectSet>
               <urn:obj type="HostSystem">host-'$hid'</urn:obj>
               <urn:skip>false</urn:skip>
               <urn:selectSet xsi:type="urn:TraversalSpec">
                   <urn:name>DSObject</urn:name>
                   <urn:type>HostSystem</urn:type>
                   <urn:path>datastore</urn:path>
                   <urn:skip>false</urn:skip>
               </urn:selectSet>
            </urn:objectSet>
         </urn:specSet>
      </urn:RetrieveProperties>
   </soapenv:Body>
</soapenv:Envelope>'



curl -k -b /tmp/vm_cookie --location --request POST 'https://'$vc'/sdk/vimService.wsdl' \
--header 'Content-Type: application/xml' \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Logout>
         <urn:_this type="SessionManager">SessionManager</urn:_this>
      </urn:Logout>
   </soapenv:Body>
</soapenv:Envelope>' \
> /dev/null
