Author Posts

November 18, 2015 at 12:50 pm

I currently have a script that works correctly. However, the way it loads is a little hard to read. I am loading AD Groups into a listbox. Currently it shows the FQDN. I need it to show a shortname so that it is easier to read.

$maduname = $mfuser.Text
$mfusergroups = Get-ADUser -Identity $maduname -Properties *
$mfadrname = $mfusergroups.CN
$mfusergroups = $mfusergroups.MemberOf | Sort
foreach ($group in $mfusergroups) {
$groupstart = $group.IndexOf("=") + 1
$groupend = $group.IndexOf(",") - 3

This is only the small section that needs to be changed.

November 18, 2015 at 8:54 pm

For terminology's sale, it is showing DistinguishedName, not FQDN; however, check out this post on the same topic.