# show current Organizational Unit list
PS C:\Users\Administrator> Get-ADOrganizationalUnit -Filter * | Format-Table DistinguishedName
DistinguishedName
-----------------
OU=Domain Controllers,DC=srv,DC=world
OU=Hiroshima,DC=srv,DC=world
# for example, add [Development01] under the [Hiroshima]
PS C:\Users\Administrator> New-ADOrganizationalUnit Development01 `
-Path "OU=Hiroshima,DC=srv,DC=world" `
-ProtectedFromAccidentalDeletion $True
# verify
PS C:\Users\Administrator> Get-ADOrganizationalUnit -Filter * | Format-Table DistinguishedName
DistinguishedName
-----------------
OU=Domain Controllers,DC=srv,DC=world
OU=Hiroshima,DC=srv,DC=world
OU=Development01,OU=Hiroshima,DC=srv,DC=world
# to delete OU,
# disable [ProtectedFromAccidentalDeletion $True] option first
# = protected option from accidental deletetion
PS C:\Users\Administrator> Set-ADOrganizationalUnit `
-Identity "OU=Development01,OU=Hiroshima,DC=srv,DC=world" `
-ProtectedFromAccidentalDeletion $false
PS C:\Users\Administrator> Remove-ADOrganizationalUnit -Identity "OU=Development01,OU=Hiroshima,DC=srv,DC=world"
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove" on target "OU=Development01,OU=Hiroshima,DC=srv,DC=world".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
|