I'm using below statement to get server lists from AD using windows server filter. I've two different domain "abc.com" and another "anil.abc.com". I've an access to read information from both the domains, when i run the script i get data only from the "abc.com" , but cannot get the server lists from "anil.abc.com". Can you please help what i can use to get a data from both using a single script ? Thanks in advance.
My script
$ScriptPath = Get-Location
Get-ADComputer -Filter {(OperatingSystem -like "windows*server") -and (Enabled -eq "True")} -Properties * | SORT Name | Select -ExpandProperty Name | Out-File $ScriptPath\ServerListNames.txt
