3

I'm currently looking into redirecting the default user and computer OU on a domain.

To my understanding, this can easily be achieved using redirusr and reditcmp. However, how can I retrieve the current state?

4 Answers 4

9

From PowerShell with the ActiveDirectory extensions loaded, run this command:

(get-adobject -filter 'ObjectClass -eq "domain"' -Properties wellKnownObjects).wellKnownObjects

Then, using the list in kb324949, you can see what the values have been changed to.

1
  • Thanks longneck, it is working and still valid in a win10 environment in 2021.
    – aaoudj
    Apr 22, 2021 at 21:34
3

Another way to retrieve that information in PowerShell is using the .Net DirectorySearcher class or as shown below PowerShell's [ADSISearcher] type accelerator. Although it's more typing and a bit harder to read, this method comes in handy if the Active Directory Web Services can't be guaranteed to be available. It's a bit less "PowerShell", but illustrates some useful PoSH/ADSI/LDAP syntax.

BTW, I'm not knocking longneck's answer, just point out an alternate way, tmtowtdi!

$a = [adsisearcher]'(&(objectclass=domain))'
$a.SearchScope = 'base'
$a.FindOne().properties.wellknownobjects | ForEach-Object {
    if ($_ -match '^B:32:A9D1CA15768811D1ADED00C04FD8D5CD:(.*)$')
    {
        'Users: {0}' -f $matches[1]
    }
    elseif ($_ -match '^B:32:AA312825768811D1ADED00C04FD8D5CD:(.*)$')
    {
        'Computers: {0}' -f $matches[1]
    }
}
1

This is pretty low-tech, but you can create a user remotely using net user testUser /add /domain and query AD to find out where it was created.

You can do the same for a test computer by joining it to the domain and searching for that the same way you did the user.

There's probably some PowerShell voodoo you can do to look at container attributes, also - so I wouldn't be surprised if you get a better answer than this.

1
Get-ADDomain | select computerscont*
2
  • 3
    This needs a lot more information to be actually useful.
    – Sven
    Mar 22, 2017 at 11:19
  • No it doesn't. This is the correct way to find the information being requested. It would be more useful if it included the context that you need to run this from an elevated powershell prompt and that you can search various properties such as ComputersContainer and UsersContainer.
    – Thomas
    Jan 31, 2019 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .