This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Auto Generation Exchange Alias

Is there away to auto generate the alias similar to the user logon name generation in ARS.

I would usually set the alias as the user logon name, however these need to be different now.
Parents
  • here is the powershell shell script....
    we are taking first character of first name followed by last name.. if this is available then first 2 character of first name followed by last name and so on..

    ==========
    function onPostModify($Request)
    {
    $givenname = $Dirobj.get("givenname").ToLower()
    $sn = $Dirobj.get("sn").ToLower().split()[-1]
    $Alias1 = $givenname.substring(0,1) + $sn.Replace(' ','')

    $exit = 0

    do
    {
    try
    {
    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue


    if ($user -eq $null) {$exit = 1}

    else

    { $Alias1 = $givenname.substring(0,2) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue

    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.substring(0,3) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue
    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.Substring(0,4) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue
    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.Substring(0,5) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue
    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.Substring(0,6) + $sn }


    }

    catch
    {

    $exit = 1
    }
    }

    while($exit -eq 0)

    $Alias1
Reply
  • here is the powershell shell script....
    we are taking first character of first name followed by last name.. if this is available then first 2 character of first name followed by last name and so on..

    ==========
    function onPostModify($Request)
    {
    $givenname = $Dirobj.get("givenname").ToLower()
    $sn = $Dirobj.get("sn").ToLower().split()[-1]
    $Alias1 = $givenname.substring(0,1) + $sn.Replace(' ','')

    $exit = 0

    do
    {
    try
    {
    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue


    if ($user -eq $null) {$exit = 1}

    else

    { $Alias1 = $givenname.substring(0,2) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue

    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.substring(0,3) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue
    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.Substring(0,4) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue
    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.Substring(0,5) + $sn }

    $user = get-recipient "$Alias1@amal.ae" -ErrorAction SilentlyContinue
    if ($user -eq $null) {$exit = 1}
    else
    { $Alias1 = $givenname.Substring(0,6) + $sn }


    }

    catch
    {

    $exit = 1
    }
    }

    while($exit -eq 0)

    $Alias1
Children
No Data