How to add one more OU on $DomainName

Welcome Forums General PowerShell Q&A How to add one more OU on $DomainName

This topic contains 2 replies, has 3 voices, and was last updated by

10 months, 1 week ago.

  • Author
  • #100978

    Points: 0
    Rank: Member

    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

    Points: 1,184
    Helping Hand
    Rank: Community Hero

    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

  • #101011

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

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

The topic ‘How to add one more OU on $DomainName’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort