I'm facing with a problem which involves both PowerCLI and the powershell binding for Lab Manager SOAP API (http://blogs.vmware.com/vipowershell/2009/01/managing-vmware-lab-manager-with-ctp3.html). For example:
$myvm = get-vm -name "myvm"
In the code above, PowerCLI is used to retrieve a VM. The identifier of $myvm can be easily retrieved using $myvm.id, where id is a string.
On the Lab Manager side, the SOAP api provides GetMachine(id), where the identifier is an integer and not related to the id string returned from the VM PowerCli object. This means that I won't be able to use GetMachine to query Lab Manager data starting from the id of a PowerCLI Get-VM.
How do I get the required VM identifier from PowerCLI to be used with GetMachine in Lab Manager SOAP API? Is it possible just using PowerCLI and Lab Manager web service or do I need to crunch the Lab Manager database??
Not really. I've just forgot about LM SOAP API. Because I was needing it only for reporting, I've been able finally to get information I need directly from the database. Anyway, there is not other way than using a SQL query on LM.
When you query lab manager you can get the VM vshpere instance id (and not name) from the view BucketVirtualServer, field dir_id