Active Directory: List Default Containers for new Users and Computers


This following script lists the default containers set in Active Directory. Usually new computer accounts are created in Computers container and new users created in Users container. You can change these default locations using ReDirCmp and ReDirUsr commands (usually available in Domain controllers at C:\windows\system32).

This following script lists the default containers set in Active Directory. Usually new computer accounts are created in Computers container and new users created in Users container.  (Thanks Mike Crowley). I found this script at HERE.

$x = Get-ADObject -Filter {isCriticalSystemObject -eq $true} | Where {($_.objectclass -eq ‘container’ -or $_.objectclass -eq ‘organizationalUnit’) -and (-not ($_.DistinguishedName -like ‘*ForeignSecurityPrincipals,DC*’)) -and (-not ($_.DistinguishedName -like ‘*CN=System,DC*’)) -and (-not ($_.DistinguishedName -like ‘*Domain Controllers,DC*’)) -and (-not ($_.DistinguishedName -like ‘*ForeignSecurityPrincipals*’))}

$x | ft *dname

The same Mike had better one line Powershell command that displays same info.

Get-ADDomain | Select UsersContainer, SystemsContainer

 

Since I found this information in a hard way, I blogged it. So you can find it. Smile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s