SAM2009
asked on
Is there a script or prog which can says if a sever is belong to a domain in AD?
Is there a script or prog which can says if a sever is belong to a domain in AD?
For exemple, I have a list of servers in a file and would like to know in which domain they are belong in AD.
Thank you.
For exemple, I have a list of servers in a file and would like to know in which domain they are belong in AD.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To determine whether a given computer in a list of computers is an active member of a given domain you can invoke
I realize this isn't exactly the solution you wanted, but it may be useful.
for /f %i in (serverfile.txt) do net view /domain:mydomain %i
The response is either a list of available shares which verifies membership, or a message that the network path was not found which suggests non-membership or out-of-service.I realize this isn't exactly the solution you wanted, but it may be useful.
Try with PowerShell (Quest cmdlets for 2003 AD)
http://www.quest.com/powershell/activeroles-server.aspx
Create text file with servers on C-Drive (one server name per line) and run in PowerShell
Regards,
Krzysztof
http://www.quest.com/powershell/activeroles-server.aspx
Create text file with servers on C-Drive (one server name per line) and run in PowerShell
Get-Content c:\servers.txt | ForEach-Object {Get-QADComputer $_ | Select name,domain | Export-CSV c:\output.csv}
Regards,
Krzysztof
ASKER
If I have many domains in AD does it works also?
yes, but you need to change a little bit search node
where dc=domain,dc=com is FQDN of your domain and you need to specify output file name
Krzysztof
Get-Content c:\servers.txt | ForEach-Object {Get-QADComputer -SearchRoot "dc=domain,dc=com" $_ | Select name,domain | Export-CSV c:\output_DomainName.csv}
where dc=domain,dc=com is FQDN of your domain and you need to specify output file name
Krzysztof
ASKER
Hhumm it just give me the last server on the list with default domain name. Could you try?
Yes, because you need to run this script for each domain separately :) So, text file with server must be from the same domain :)
Krzysztof
Krzysztof
ASKER
That what I did ok I will try one more time later and let see.
ASKER
Thank you
Thanks,
Chandra