R
R
Rus2018-12-17 11:23:25
Active Directory
Rus, 2018-12-17 11:23:25

AD how to parse cn attribute?

How to take "Ivanovich" from the cn=Ivanov Ivan Ivanovich attribute, i.e. take only patronymic

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Choporov, 2018-12-17
@tolstyiii

PoShem, it's just a question of how standardized this attribute is for you. And so - this is a regular string, parse it by space, and after the second take it. Read up on string operations in the power shell. As an example:
$cn = (Get-ADUser -Properties cn).cn
$cn.Split(" ")[3]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question