Quantcast
Channel: Exchange Server 2013 - Administration, Monitoring, and Performance 论坛
Viewing all articles
Browse latest Browse all 8719

How to populate only empty "Simple Display Name-fields" of mailboxes using script

$
0
0
I am trying to populate only empty field of simple display name of mailboxes using (FirstName +Initials + LastName), leaving the users mailboxes who already have SDN fields and searching from in a specific organization unit. i tried below script but not getting the desire result. it searching the empty SDN but only updating mailboxes who already have SDN Fields.

Get-mailbox -OrganizationalUnit "TEST.com/ITDept/ITDeptUsers" -Filter {SimpleDisplayName -ne '*'};
foreach ($mbx in $Users)
{       
        $user = get-user $mbx;
        $sdn = "$($user.FirstName) $($user.Initials) $($user.LastName)";
        $sdn = $sdn.Trim() ;
        Write-Host "`n Setting sdn '$sdn'";
        Set-user $user -simpleDisplayName $sdn
}

kindly help me to correct this script.

Viewing all articles
Browse latest Browse all 8719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>