Scan servers for domain name

Hello Experts

We have 3 domains.
what is the easiest way to scan for servers and get info on what domain they belong to??

thanks in advance
Ann AbedAsked:
Who is Participating?
Chirag NagrekarSystem AnalystCommented:
Assuming you have list of servers (list.txt) and you want to get their FQDN.

Use below powershell script to get FQDN of servers.

ForEach ($computer in (Get-Content list.txt)) {
    Try {
        [net.dns]::GetHostEntry($Computer).Hostname | Out-File -FilePath systems.txt -Append
    } Catch {
        $Computer | Out-File -FilePath systems.txt -Append

Output file will be systems.txt
Shaun VermaakTechnical Specialist/DeveloperCommented:
Another way is to export a list of computers from each of the three domains and use that to check to which domain they are joined
Ann AbedAuthor Commented:
Thank you so much. worked like magic :)
Ann AbedAuthor Commented:
Thank you Chirag Nagrekar :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.