Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

Thanks

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I've use Get-WmiObject Win32_NTDomain in the past just to get a list of domains. I've noticed the domainName is null when a workstation isn't part of a domain.

share|improve this answer
    
Thanks, I will give this a try. –  senf Jan 13 '10 at 23:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.