timmcmic / DLConversionV2

MIT License
44 stars 9 forks source link

Cannot bind argument to parameter 'String' because it is null. #128

Closed smtp25gmailcom closed 1 year ago

smtp25gmailcom commented 1 year ago

Im getting this on 3 out of 5 distribution lists migrations it seems. At first I thought it was failed attempts (does this require manual cleanup of removing the guid DL created in EXO?) but its also happening to other DL's never migrated before.

When I ran it as a single migration instead of a batch it would flash on the screen quick about managementobject not found, when running as a batch I think this is still happening its just I cant see it from the logs. I don't have AADConnect on the cmdline so its doing the wait\sleep. (need to resolve ps-remoting issue before aadconnect invoke will work).

Start-MultipleDistributionListMigration -groupSMTPAddresses $groups -globalCatalogServer DC1.company.co.nz -activeDirectoryCredential $ADonPremCred -exchangeServer EX1.company.co.nz -exchangeCredential $onPremCred -EXCHANGEAUTHENTICATIONMETHOD Kerberos -exchangeOnlineCredential $cloudCred -AzureADCredential $cloudcred -logFolderPath e:\dlmigresults -dnNoSyncOU "OU=DoNotSync DLs,OU=Exchange,DC=company,DC=co,DC=nz" -retainOriginalGroup $true -enableHybridMailFlow $true -overrideCentralizedMailTransportEnabled:$true

Im getting this error [16/03/2023 10:01:37 PM] - **** [16/03/2023 10:01:37 PM] - **** [16/03/2023 10:01:37 PM] - BEGIN INVOKE-ADCONNECT [16/03/2023 10:01:37 PM] - **** Out-LogFile : Cannot bind argument to parameter 'String' because it is null. At C:\Program Files\WindowsPowerShell\Modules\DLConversionV2\2.9.6.8\Invoke-ADConnect.ps1:56 char:33

And this error not on the same DL but still

[16/03/2023 12:45:05 PM] - BEGIN GET-O365DLCONFIGURATION [16/03/2023 12:45:05 PM] - **** Get-O365DLConfiguration : Cannot bind argument to parameter 'String' because it is null. At C:\Program Files\WindowsPowerShell\Modules\DLConversionV2\2.9.6.8\DLConversionV2.psm1:1432 char:39

It does have the group name as it lists it at the start

[16/03/2023 12:44:06 PM] - ================================================================================ [16/03/2023 12:44:06 PM] - START LOG FILE [16/03/2023 12:44:06 PM] - ================================================================================ [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - NOCTICE [16/03/2023 12:44:06 PM] - Telemetry collection is now enabled by default. [16/03/2023 12:44:06 PM] - For information regarding telemetry collection see https://timmcmic.wordpress.com/2022/11/14/4288/ [16/03/2023 12:44:06 PM] - Administrators may opt out of telemetry collection by using -allowTelemetryCollection value FALSE [16/03/2023 12:44:06 PM] - Telemetry collection is appreciated as it allows further development and script enhacement. [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - PARAMETERS [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - ****

ParameterName Bound ParameterValue


groupSMTPAddress True ITOServicesTransition@company.com
activeDirectoryCredential True System.Management.Automation.PSCredential

timmcmic commented 1 year ago

Ok - I think this was introduced by a change I took to make multiple migrations more robust.

A few weeks ago we had an issue posted where thread 1 was failing on a large migration. I took a change so that if the group was not deleted after X retries each thread would attempt AD Connect. I think in the multi migration code I failed to account for what happens when you intentionally did not specify an ad connect server.

Give me a minute to look it over but I'm pretty sure that's what's up.

Tim

============================== Timothy J. McMichael Senior Support Escalation Engineer @.**@.> (980)-776-7465

Hours: Sunday - Wednesday 08:00 - 16:00 eastern time zone.

Manager: Tom Roughley @.**@.>)

Premier Support - (800)-936-3100 Broad Commercial Support - (800)-936-4900

==============================

From: smtp25gmailcom @.> Sent: Thursday, March 16, 2023 5:48 AM To: timmcmic/DLConversionV2 @.> Cc: Subscribed @.*> Subject: [timmcmic/DLConversi**onV2] Cannot bind argument to parameter 'String' because it is null. (Issue #128)

Im getting this on 3 out of 5 distribution lists migrations it seems. At first I thought it was failed attempts (does this require manual cleanup of removing the guid DL created in EXO?) but its also happening to other DL's never migrated before.

When I ran it as a single migration instead of a batch it would flash on the screen quick about managementobject not found, when running as a batch I think this is still happening its just I cant see it from the logs. I don't have AADConnect on the cmdline so its doing the wait\sleep. (need to resolve ps-remoting issue before aadconnect invoke will work).

Start-MultipleDistributionListMigration -groupSMTPAddresses $groups -globalCatalogServer DC1.company.co.nz -activeDirectoryCredential $ADonPremCred -exchangeServer EX1.company.co.nz -exchangeCredential $onPremCred -EXCHANGEAUTHENTICATIONMETHOD Kerberos -exchangeOnlineCredential $cloudCred -AzureADCredential $cloudcred -logFolderPath e:\dlmigresults -dnNoSyncOU "OU=DoNotSync DLs,OU=Exchange,DC=company,DC=co,DC=nz" -retainOriginalGroup $true -enableHybridMailFlow $true -overrideCentralizedMailTransportEnabled:$true

Im getting this error [16/03/2023 10:01:37 PM] - **** [16/03/2023 10:01:37 PM] - **** [16/03/2023 10:01:37 PM] - BEGIN INVOKE-ADCONNECT [16/03/2023 10:01:37 PM] - **** Out-LogFile : Cannot bind argument to parameter 'String' because it is null. At C:\Program Files\WindowsPowerShell\Modules\DLConversionV2\2.9.6.8\Invoke-ADConnect.ps1:56 char:33

And this error not on the same DL but still

[16/03/2023 12:45:05 PM] - BEGIN GET-O365DLCONFIGURATION [16/03/2023 12:45:05 PM] - **** Get-O365DLConfiguration : Cannot bind argument to parameter 'String' because it is null. At C:\Program Files\WindowsPowerShell\Modules\DLConversionV2\2.9.6.8\DLConversionV2.psm1:1432 char:39

It does have the group name as it lists it at the start

[16/03/2023 12:44:06 PM] - ================================================================================ [16/03/2023 12:44:06 PM] - START LOG FILE [16/03/2023 12:44:06 PM] - ================================================================================ [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - NOCTICE [16/03/2023 12:44:06 PM] - Telemetry collection is now enabled by default. [16/03/2023 12:44:06 PM] - For information regarding telemetry collection see https://timmcmic.wordpress.com/2022/11/14/4288/https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftimmcmic.wordpress.com%2F2022%2F11%2F14%2F4288%2F&data=05%7C01%7Ctimmcmic%40microsoft.com%7Cc257c8bb918c4d0a179208db26038bcb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638145568894636677%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5swZ3NPn92dNQHc47OIr0Rmllf5hDzAKHH%2FcBUxTfrM%3D&reserved=0 [16/03/2023 12:44:06 PM] - Administrators may opt out of telemetry collection by using -allowTelemetryCollection value FALSE [16/03/2023 12:44:06 PM] - Telemetry collection is appreciated as it allows further development and script enhacement. [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - PARAMETERS [16/03/2023 12:44:06 PM] - **** [16/03/2023 12:44:06 PM] - ****

ParameterName Bound ParameterValue


groupSMTPAddress True @.**@.> activeDirectoryCredential True System.Management.Automation.PSCredential

- Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftimmcmic%2FDLConversionV2%2Fissues%2F128&data=05%7C01%7Ctimmcmic%40microsoft.com%7Cc257c8bb918c4d0a179208db26038bcb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638145568894636677%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jYNTmEOyVF9NG8RtHCbjz2xFcqp4%2FgC%2BfSFsPU6NtjU%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKGTN6M3IAKX4HSJOJLC5BTW4LOVNANCNFSM6AAAAAAV46ZC34&data=05%7C01%7Ctimmcmic%40microsoft.com%7Cc257c8bb918c4d0a179208db26038bcb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638145568894636677%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3iXESbA7PXLdmIB17gNBPOO02O1oyZJ5pB8nVIKkZZA%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

timmcmic commented 1 year ago

This should be fixed in the version I just released. I put checks in to see if ad connect is in use and if not in use then the test dl function is not called with it and it just loops and waits for deletion rather than try to proactively invoke ad connect.

TPok1707 commented 1 year ago

Hi, I just have the case that it is still happening in version 2.9.7.0. Log can be provided directly, not in public.

timmcmic commented 1 year ago

Sure I'd love to take a look at these.

The logs can be sent privately to dlconversionv2 @ service dot microsoft dot com

Tim

============================== Timothy J. McMichael Senior Support Escalation Engineer @.**@.> (980)-776-7465

Hours: Sunday - Wednesday 08:00 - 16:00 eastern time zone.

Manager: Tom Roughley @.**@.>)

Premier Support - (800)-936-3100 Broad Commercial Support - (800)-936-4900

==============================

From: TPok1707 @.> Sent: Wednesday, March 22, 2023 9:38 AM To: timmcmic/DLConversionV2 @.> Cc: Tim McMichael @.>; Comment @.> Subject: Re: [timmcmic/DLConversionV2] Cannot bind argument to parameter 'String' because it is null. (Issue #128)

Hi, I just have the case that it is still happening in version 2.9.7.0. Log can be provided directly, not in public.

- Reply to this email directly, view it on GitHubhttps://github.com/timmcmic/DLConversionV2/issues/128#issuecomment-1479582496, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKGTN6OIOQGKSRBWFKTZTDDW5L6EDANCNFSM6AAAAAAV46ZC34. You are receiving this because you commented.Message ID: @.**@.>>

TPok1707 commented 1 year ago

Log sent. Please tell me if I can assist somehow.

timmcmic commented 1 year ago

Closing this issue.

The root cause is the mail address of the active directory object did not appear on the proxy addresses of the same object. This caused the mail address to not be present in exchange online. In the get-365Distributionlist function the groupSMTPAddress is fed in and then get-o365Recipient is called to get the working recipient. Issue was that this returned an exception that was unhandled. So the call was made, recipient not found, and the variable holding the configuration empty. The script then attempted to output it to the logs which caused an string null exception. New code was added to try catch the recipient capture and then output the exception if it's not found.

============================== Timothy J. McMichael Senior Support Escalation Engineer @.**@.> (980)-776-7465

Hours: Sunday - Wednesday 08:00 - 16:00 eastern time zone.

Manager: Tom Roughley @.**@.>)

Premier Support - (800)-936-3100 Broad Commercial Support - (800)-936-4900

==============================

From: TPok1707 @.> Sent: Wednesday, March 22, 2023 10:30 AM To: timmcmic/DLConversionV2 @.> Cc: Tim McMichael @.>; Comment @.> Subject: Re: [timmcmic/DLConversionV2] Cannot bind argument to parameter 'String' because it is null. (Issue #128)

Log sent. Please tell me if I can assist somehow.

- Reply to this email directly, view it on GitHubhttps://github.com/timmcmic/DLConversionV2/issues/128#issuecomment-1479671604, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKGTN6P6N47MYLCN5RMJKJTW5MEE3ANCNFSM6AAAAAAV46ZC34. You are receiving this because you commented.Message ID: @.**@.>>