Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1134
  • Last Modified:

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.
0
Adam Brown
Asked:
Adam Brown
  • 2
1 Solution
 
KenMcFCommented:
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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now