Unable to Export computers from Security group inside OU

Hi Gents,

I’m trying to export the list of computers from an OU by using below command.

Get-adcomputer -filter * -searchbase “Distinguished Name of the path” | select name

I’m able to get the results if there is no security group inside the OU but if there is any security inside OU and if the SG contains the computer objects i don’t get results.

For example,

Domain Name->OU->Computer = Works

Domain Name->OU->Secuity Group->Computer = Not works

Is how powershell works or do i make any mistake in the above command? Thanks in advance!

This is how the active directory works. :wink: … the actual computer accounts are probably in another OU. But you can add any computer account to a security group. If you like to get the members of this particular group you can use Get-ADGroupMember oder Get-ADPrincipalGroupMembership.