Thank you for your quick response. I have tried running what you linked to.

Unfortunately, I am currently getting this error:

Run-time '-2147463155 (8000500d)': The directory property cannot be found in the cache". This is occurring on the strDNSDomain = objRootDSE.Get("defaultNamingContext") line...