How to add one more OU on $DomainName

This topic contains 2 replies, has 3 voices, and was last updated by  Don Jones 4 weeks, 1 day ago.

  • Author
    Posts
  • #100978

    BGomes
    Participant

    Hello world!!!
    How to add one more OU on $DomainName? I would like to add 'LDAP://OU=TST,DC=fenix,DC=com' and keep 'LDAP://CN=Computers,DC=fenix,DC=com'.

    $DomainName = 'LDAP://CN=Computers,DC=fenix,DC=com'
    $Root = New-Object DirectoryServices.DirectoryEntry $DomainName
    $objSearcher = New-Object DirectoryServices.DirectorySearcher
    $objSearcher.SearchRoot = $Root
    $objSearcher.SearchScope = "SubTree"

    $ADResults = @()

    $colResults = $objSearcher.FindAll()
    foreach ($objResult in $colResults)

  • #100989

    Olaf Soyk
    Participant

    I'm not sure if I got you right but you can create a new organizational unit simply with the cmdlet of the module ActiveDirectory
    New-ADOrganizationalUnit.

  • #101011

    Don Jones
    Keymaster

    A computer can't live in more than one OU.

You must be logged in to reply to this topic.