VMware {code} Community
Ahnaf
Contributor
Contributor

Need to get CreationDate of VM - C#

Hi , I am trying to get all the VM's from Our vCenter server. I can successfully get all the servers but then i need to see when each VM was created.

How can i get the created Date from SDK?

I am using the vCenter Inventory sample - https://code.vmware.com/samples?categories=Sample&keywords=&tags=C%23&groups=&filters=&sort=score&pa...

Please help out how can i get the vm created date.

Thanks

Tags (1)
3 Replies
TVPL
Contributor
Contributor

Try this: DateTime vmDateCreated = vm.Resource.DateCreated;

0 Kudos
Ahnaf
Contributor
Contributor

Hi TVPL,

Thanks for your answer but there is no Field for VirtualMachine object called Resources. Please see below -

pastedImage_0.png

Do i need to convert the object to something else?

Many thanks

0 Kudos
TVPL
Contributor
Contributor

Oh sorry, I'm using the vCloud SDK for .NET  in here: vCloud SDK for .NET for vCloud Suite 5.5 - VMware {code} .

You can download VMware-vCloudDirector-.NetSDK-5.5.0-1294396.zip with content libraries, examples... included.

In your sample, i don't sure but you can try with properties of ResourceConfig... .