none
How can I know the Default Computer Container RRS feed

  • Question

  • Hi,

    This is my first post. I am curently preparing exam 70-640 and I'd like to know how can I know the Default Computer Container?

    I know how to change it but not how to know which one it is.

    Can someone help me?

    Many thanks in advance!

    Regards,

    Friday, February 24, 2012 10:47 AM

Answers

  • The information is saved  in the wellKnownObjects attribute of the domain object. This multi-valued attribute has syntax DNWithBinary, which takes special code to convert into readable format. I don't know of a command line utility that can read the values. The well-known GUID for the default OU/container for computer objects is AA312825768811D1ADED00C04FD8D5CD. Following is VBScript code to output the GUID's and the corresponding distinguished names from the wellKnownObjects attribute of the domain object:

    Option Explicit

    Dim objRootDSE, strDNSDomain, objDomain, arrWKOs, WKO, objWKO

    Set objRootDSE = GetObject("LDAP://RootDSE")
    strDNSDomain = objRootDSE.Get("defaultNamingContext")
    Set objDomain = GetObject("LDAP://" & strDNSDomain)

    arrWKOs = objDomain.wellKnownObjects
    For Each WKO In arrWKOs
        Set objWKO = WKO
        Wscript.Echo "GUID: " & OctetToHexStr(objWKO.BinaryValue)
        Wscript.Echo "-- DN: " & objWKO.DNString
    Next

    Function OctetToHexStr(ByVal arrbytOctet)
        ' Function to convert OctetString (byte array) to Hex string.

        Dim k

        OctetToHexStr = ""
        For k = 1 To Lenb(arrbytOctet)
            OctetToHexStr = OctetToHexStr _
                & Right("0" & Hex(Ascb(Midb(arrbytOctet, k, 1))), 2)
        Next

    End Function

    -----

    Following are all of the well-known GUIDs:


    Richard Mueller - MVP Directory Services


    Symbolic name for well-known GUID        GUID
    ---------------------------------        -----------------
    GUID_COMPUTERS_CONTAINER_W            AA312825768811D1ADED00C04FD8D5CD
    GUID_DELETED_OBJECTS_CONTAINER_W        18E2EA80684F11D2B9AA00C04F79F805
    GUID_DOMAIN_CONTROLLERS_CONTAINER_W        A361B2FFFFD211D1AA4B00C04FD7D83A
    GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_W    22B70C67D56E4EFB91E9300FCA3DC1AA
    GUID_INFRASTRUCTURE_CONTAINER_W            2FBAC1870ADE11D297C400C04FD8D5CD
    GUID_LOSTANDFOUND_CONTAINER_W            AB8153B7768811D1ADED00C04FD8D5CD
    GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_W        F4BE92A4C777485E878E9421D53087DB
    GUID_NTDS_QUOTAS_CONTAINER_W            6227F0AF1FC2410D8E3BB10615BB5B0F
    GUID_PROGRAM_DATA_CONTAINER_W            09460C08AE1E4A4EA0F64AEE7DAA1E5A
    GUID_SYSTEMS_CONTAINER_W            AB1D30F3768811D1ADED00C04FD8D5CD
    GUID_USERS_CONTAINER_W                A9D1CA15768811D1ADED00C04FD8D5CD
    GUID_MANAGED_SERVICE_ACCOUNTS_CONTAINER_W    1EB93889E40C45DF9F0C64D23BBB6237

    -----


    Friday, February 24, 2012 4:02 PM
  • Hello,

    if you do not change anything it is the container named Computer under the domain name in AD UC.

    If it was changed then you can use redircmp to make it default again. http://technet.microsoft.com/en-us/library/cc770619(v=ws.10).aspx


    Best regards

    Meinolf Weber
    MVP, MCP, MCTS
    Microsoft MVP - Directory Services
    My Blog: http://msmvps.com/blogs/mweber/

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.


    Friday, February 24, 2012 10:49 AM
  • ReDirCmp "OU=Managed Computers,DC=mydomain,DC=com"
    Friday, February 24, 2012 10:53 AM

All replies

  • Hello,

    if you do not change anything it is the container named Computer under the domain name in AD UC.

    If it was changed then you can use redircmp to make it default again. http://technet.microsoft.com/en-us/library/cc770619(v=ws.10).aspx


    Best regards

    Meinolf Weber
    MVP, MCP, MCTS
    Microsoft MVP - Directory Services
    My Blog: http://msmvps.com/blogs/mweber/

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.


    Friday, February 24, 2012 10:49 AM
  • Thank you!

    But is there any cmd that can indicate me the default one? 

    Regards,

    Friday, February 24, 2012 10:50 AM
  • ReDirCmp "OU=Managed Computers,DC=mydomain,DC=com"
    Friday, February 24, 2012 10:53 AM
  • The information is saved  in the wellKnownObjects attribute of the domain object. This multi-valued attribute has syntax DNWithBinary, which takes special code to convert into readable format. I don't know of a command line utility that can read the values. The well-known GUID for the default OU/container for computer objects is AA312825768811D1ADED00C04FD8D5CD. Following is VBScript code to output the GUID's and the corresponding distinguished names from the wellKnownObjects attribute of the domain object:

    Option Explicit

    Dim objRootDSE, strDNSDomain, objDomain, arrWKOs, WKO, objWKO

    Set objRootDSE = GetObject("LDAP://RootDSE")
    strDNSDomain = objRootDSE.Get("defaultNamingContext")
    Set objDomain = GetObject("LDAP://" & strDNSDomain)

    arrWKOs = objDomain.wellKnownObjects
    For Each WKO In arrWKOs
        Set objWKO = WKO
        Wscript.Echo "GUID: " & OctetToHexStr(objWKO.BinaryValue)
        Wscript.Echo "-- DN: " & objWKO.DNString
    Next

    Function OctetToHexStr(ByVal arrbytOctet)
        ' Function to convert OctetString (byte array) to Hex string.

        Dim k

        OctetToHexStr = ""
        For k = 1 To Lenb(arrbytOctet)
            OctetToHexStr = OctetToHexStr _
                & Right("0" & Hex(Ascb(Midb(arrbytOctet, k, 1))), 2)
        Next

    End Function

    -----

    Following are all of the well-known GUIDs:


    Richard Mueller - MVP Directory Services


    Symbolic name for well-known GUID        GUID
    ---------------------------------        -----------------
    GUID_COMPUTERS_CONTAINER_W            AA312825768811D1ADED00C04FD8D5CD
    GUID_DELETED_OBJECTS_CONTAINER_W        18E2EA80684F11D2B9AA00C04F79F805
    GUID_DOMAIN_CONTROLLERS_CONTAINER_W        A361B2FFFFD211D1AA4B00C04FD7D83A
    GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_W    22B70C67D56E4EFB91E9300FCA3DC1AA
    GUID_INFRASTRUCTURE_CONTAINER_W            2FBAC1870ADE11D297C400C04FD8D5CD
    GUID_LOSTANDFOUND_CONTAINER_W            AB8153B7768811D1ADED00C04FD8D5CD
    GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_W        F4BE92A4C777485E878E9421D53087DB
    GUID_NTDS_QUOTAS_CONTAINER_W            6227F0AF1FC2410D8E3BB10615BB5B0F
    GUID_PROGRAM_DATA_CONTAINER_W            09460C08AE1E4A4EA0F64AEE7DAA1E5A
    GUID_SYSTEMS_CONTAINER_W            AB1D30F3768811D1ADED00C04FD8D5CD
    GUID_USERS_CONTAINER_W                A9D1CA15768811D1ADED00C04FD8D5CD
    GUID_MANAGED_SERVICE_ACCOUNTS_CONTAINER_W    1EB93889E40C45DF9F0C64D23BBB6237

    -----


    Friday, February 24, 2012 4:02 PM
  • You can also bind to the objects by the well-known GUIDs. The trick is to specify <WKGUID=xxxx,dc=MyDomain,dc=com> in the binding string, where xxxx is the well-known GUID and the domain is MyDomain.com. For  example in VBScript:

    Set objComputers = GetObject("LDAP://<WKGUID=aa312825768811d1aded00c04fd8d5cd,dc=MyDomain,dc=com>")
    Wscript.Echo "Computers container: " & objComputers.distinguishedName

    -----

    In PowerShell:

    $Computers = [ADSI]"LDAP://<WKGUID=aa312825768811d1aded00c04fd8d5cd,dc=MyDomain,dc=com>"
    "Computers container: " + $Computers.distinguishedName

    -----



    Richard Mueller - MVP Directory Services

    Friday, February 24, 2012 11:56 PM