Not sure what you mean by PURE NT DOMAIN there Lonkero. Brian's solutions works well. However it does not support the use of other symbols in the name such as $ I thought using $$ might work, but that fails as well.

I have JMSMITH account and $JMSMITH account. This script does not think the $JMSMITH account is valid. I tried adding "$$JMSMITH" but still comes back as invalid.