$U = Get-ADUser $env:username -Properties cn
$uParent =$u.DistinguishedName.Substring( ( $u.cn ).Length + 4 )
This way we can use the fast string method and we will always remove up to the correct position. Regardless of the parent object container type (OU, Container, whatever...)
No comments:
Post a Comment