I use VMWare snapshots a lot and reverting to an earlier snapshot sometimes drops the computer off the domain controller. I am looking for a PowerShell script that would determine that the workstation is not longer part of a domain and only if it is not add it back to the domain. The Add-Computer part is the easy one, but finding out about the state of the domain association is more tricky. Any ideas are welcome. By the way I looked at WMI Win32_ComputerSystem calls and the Domain and Domain role properties. Would this be the right way to go?