Set virtual Attribute in User Provisioning Process

Hello,

i want to set a virtualAttribute in the user provisioning process. We enter the Last Name and we want to save it temp without "Ä/Ö etc.".

After that we want to use this virtual attribute for generating the SAM-Accountname

Thanks in advance,

Michael

Parents
  • Hi  

    You can use something like the below (not my code, src: active directory - How remove accents in PowerShell? - Stack Overflow) to remove Diacritics from a string. I've used something similar before to the below code to remove special characters.

    function Remove-Diacritics {
    param ([String]$src = [String]::Empty)
      $normalized = $src.Normalize( [Text.NormalizationForm]::FormD )
      $sb = new-object Text.StringBuilder
      $normalized.ToCharArray() | % { 
        if( [Globalization.CharUnicodeInfo]::GetUnicodeCategory($_) -ne [Globalization.UnicodeCategory]::NonSpacingMark) {
          [void]$sb.Append($_)
        }
      }
      $sb.ToString()
    }
    
    # Test data
    @("Rhône", "Basíl", "Åbo", "", "Gräsäntörmä") | % { Remove-Diacritics $_ }

    However please note this is not a perfect solution for all languages, but will probably hit 90 to 95%

    Also note if you're using this to samAccountName, it will not take account of other special characters in the string like ' or - for names like "O'Neil" or "Smith-Jones", which you'll need to handle seperately

    Hope this help

  • Hi Stu,

    i already have a script in place which replaces the characters i do not want (PostCreate). But we use Lastname and Forename to generate the SAM with 8 characters. After replacing the unwanted characters we have the issue that the SAM is 9 or more characters long.

    What we want is to save the lastname into the virtual attribute and use this one for generating the SAM in the user privisoning process.

    Can you help me out here? What i tried is:
    $Request.SetEffectivePolicyInfo($virtualattribute, $Request.EDS_EPI_UI_GENERATED_VALUE, $adaptedlastname)

    But this is not working.


    Regards,

    Michael

Reply
  • Hi Stu,

    i already have a script in place which replaces the characters i do not want (PostCreate). But we use Lastname and Forename to generate the SAM with 8 characters. After replacing the unwanted characters we have the issue that the SAM is 9 or more characters long.

    What we want is to save the lastname into the virtual attribute and use this one for generating the SAM in the user privisoning process.

    Can you help me out here? What i tried is:
    $Request.SetEffectivePolicyInfo($virtualattribute, $Request.EDS_EPI_UI_GENERATED_VALUE, $adaptedlastname)

    But this is not working.


    Regards,

    Michael

Children