Author Posts

May 22, 2018 at 1:45 am

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)

May 22, 2018 at 6:06 am

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.

May 22, 2018 at 1:07 pm

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