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
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)
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
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.