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
$mfuseroutbox.Items.Add("$group")
}
This is only the small section that needs to be changed.