Is server.domain.com a Global Catalog Server? If it is, use "server.domain.com:3268" instead of just the server name. You'll probably have to add a -SearchBase to the cmdlet, too. The value of that should be the root domain of the AD forest. That should search ALL domains in the AD forest.
Get all active directory computers from all domains
Hi,
I need to get all Active Directory computers from five different domains. The script below has executed without errors except for one domain. This is the code I am using:
Get-ADComputer -Filter * -Properties * -Server "server.domain.com" | Select-Object Name
This is the error I am seeing:
Get-ADComputer : Directory object not found
At line:1 char:1
+ Get-ADComputer -Filter * -Properties * -Server "server.domain.com" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-ADComputer], ADIdentityNotFoundException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Management.Comm
ands.GetADComputer
I get that the error message says the Directory object is not found but without changing anything but the server name, the script is working fine in the other domains.
Thank you!
Rob
1 additional answer
Sort by: Most helpful
-
Rob M 61 Reputation points
2022-03-28T22:09:30.807+00:00 I made one change and it seems to be working now:
Get-ADComputer -Filter * -Properties Name -Server "server.domain.com" | Select-Object Name
I added in the name of a property before the pipe, Name.
The other domains didn't need anything other than -Properties *. Why is this domain different?
-Rob