timmcmic / DLConversionV2

MIT License
43 stars 9 forks source link

Error new-adobject : A value for the attribute was not in the acceptable range of values #132

Closed githubths closed 1 year ago

githubths commented 1 year ago

Main Function : Start-DistributionListMigration

Sub Function : new-RoutingContact.ps1

Error:

new-adobject : A value for the attribute was not in the acceptable range of values At C:\Program Files\WindowsPowerShell\Modules\DLConversionV2\2.9.7.0\new-RoutingContact.ps1:257 char:13

Line : 222

$functionName Variable including the suffix "MigratedByScript" is longer than 64 Character The -Name Attribute throws the error

Quic Helper to resolve .. IF($functionName.Length -gt 64){$functionName = $functionName.Substring(0,64)}

timmcmic commented 1 year ago

Fixed in 2.9.8.1

There are actually multiple items that can occur here if the group name has 64 characters.

The following changes were deployed.

Change mail contact first name to simply be the group name and not use -migratedByScript. Updated mail nickname to truncate the end of the group name and add -migratedByScript to not exceed 64 characters. Updated both CN and NAME to do the same as mail nickname.

Updated the rename group function to truncate the last character if count is 64 so the ! can be successfully added.