We are building virtual desktops for another organization that we have a two way domain level trust with. The desktops get their IP addresses from Domain A and then register their A records on DNS server in Domain B and join to the Domain B windows domain. This works very well.
However, when the desktop is destroyed (every time a log our or disconnection occurs) the DHCP server releases the IP address, based on a very short lease duration, builds a new desktop with the same name, then gets a new DHCP address with a different MAC address. However, the old machine name and IP address is never removed from Domain B's DNS servers so the new IP address is never registered and hense, the desktop cannot reach the domain resources it requires in Domain B.
If we manually delete the A records from the Domain B DNS server then the recreated machines will register themselves just fine. It's the re-registration that's killing me.
Is there any solution short of mucking with routing and trying to use the DHCP server in domain B? It would be nice if a script could be run at log out that would delete the A record. I've tried testing with the dnscmd /recorddelete command but cannot get it to successfully delete an A record even when it tells me it did.
Any script would have to be run with sufficient privileges to delete the record and it would have to know the IP address to make it happen.
Any ideas. I'm stumped.