I'm no code-monkey, but let me have a stab at this anyways...
I'd put money on the fact that it's broken because the box isn't a DC anymore.
When I did my powershell course, we spoke about this sort of scenario, and were
told to always bind to the namespace, rather than a particular server. Perhaps
something along the lines of objRootDSE =
GetObject("LDAP://dc=domain,dc=tld/rootDSE") might work??? (again, I'm no
code-monkey, so don't be surprised if it doesn't work!)
Alternatively, is it possible to run the script against a known DC, just to see
if that is the problem?