Trimming info in a string

I need to be able to chop the CN section of a user's Distinguished name so it leaves the DN of the folder that the user's account is located in. Any recommendations on how to parse this or easy methods to pull that? My brain's a little fried right now but this is blocking me from moving forward on this project.
LVL 44
Adam BrownSr Solutions ArchitectAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
KenMcFConnect With a Mentor Commented:
I think this is what you are looking for

get-qaduser USERNAME | select ParentContainerDN

or

(get-qaduser USERNAME)ParentContainerDN
0
 
Adam BrownSr Solutions ArchitectAuthor Commented:
Fuf...Can't believe I didn't find that attribute. Been too long since I've messed with powershell. Thanks :D
0
 
louisreevesCommented:
I am not sure of the scope of what you are doing. Are you wanting to chop many CNs? I would look at using the find and replace feature, of the top of my head. Maybe if I know more about the way you are working, and the goal of what the chopping is all about, I could help more.  
0
 
KenMcFCommented:
No problem, glad it worked out
0
All Courses

From novice to tech pro — start learning today.