Hi hugong, if the IP address is still being marked as used in the vCAC network profile it will not be reclaimed automatically (only if it is marked as being destroyed; then the IP address will be reclaim after 30min not being uses anymore; as the Reclaim workflow runs every 5min, after a total of max 35min the IP will be returned to the pool).
So what you can do is; mark the IP address as being destroyed and wait for the regular reclaim workflow (you can of course also manually reclaim the IP address altogether). If you insert a script into the disposing or unprovision workflow this will achieve the result. As an alternative yo can start a schduled workflow/script that checks IP addresses for not being used any more (also possibly cross checking DNS/IPAM) to mark the IP address as free and return it to the pool.
The easiest thing in my opinion is to use the ManagementContext (ManagementModelClient) and check for the StaticIPv4Addresses property (or to walk the tree from the VirtualMachine to the StaticIPv4Addresses). For an example to use the ManagementContext you can have a look at this post: http://d-fens.ch/2013/10/10/investigating-the-vcac-5-2-mgmtcontext
Hope that helps
Regards, Ronald
Ronald Rink
d-fens GmbH