timmcmic / DLConversionV2

MIT License
46 stars 10 forks source link

Fails from undefined parameters without asking to define parameters #10

Closed dickfrazier closed 3 years ago

dickfrazier commented 3 years ago

When trying to run I was able to install and import the module, it asks for some parameters but not all the ones I expect and then fails and closes the powershell window. I am probably doing it wrong, where do I set the params ahead of time like I did with V1? The parameters it asks for and I give it before it fails are:

groupSMTPAddress globalCatalogServer activeDirectoryCredential logFolderPath dnNoSyncOU

image

`[9/22/2021 9:02:38 AM] - **** [9/22/2021 9:02:38 AM] - ENTERING PARAMTER VALIDATION [9/22/2021 9:02:38 AM] - **** [9/22/2021 9:02:38 AM] - Validating that both AADConnectServer and AADConnectCredential are specified [9/22/2021 9:02:38 AM] - Neither AADConnect Server or AADConnect Credentials specified - retain useAADConnect FALSE - False [9/22/2021 9:02:38 AM] - Validating that both ExchangeServer and ExchangeCredential are specified. [9/22/2021 9:02:38 AM] - Neither Exchange Server or Exchange Credentials specified - retain useOnPremisesExchange FALSE - False [9/22/2021 9:02:38 AM] - Validating Exchange Online Credentials. [9/22/2021 9:02:38 AM] - ERROR: One permissions method to connect to Exchange Online must be specified. [9/22/2021 9:02:38 AM] - **** [9/22/2021 9:02:38 AM] - BEGIN disable-allPowerShellSessions [9/22/2021 9:02:38 AM] - **** [9/22/2021 9:02:38 AM] - Gathering all PS Sessions [9/22/2021 9:02:38 AM] - Disconnecting Exchange Online Session [9/22/2021 9:02:38 AM] - END disable-allPowerShellSessions [9/22/2021 9:02:38 AM] - **** [9/22/2021 9:02:38 AM] - Archiving files associated with run. [9/22/2021 9:02:38 AM] - Split string for group name. C: DLConversionV2 logs DLMigration

hashtagtestdltoconvert.log

[9/22/2021 9:02:38 AM] - Split string for group name.

hashtagtestdltoconvert

log [9/22/2021 9:02:38 AM] - FAILED - renaming directory. [9/22/2021 9:02:38 AM] - 20210922T0902384613-#hashtagtestdltoconvert-FAILED [9/22/2021 9:02:38 AM] - C:\DLConversionV2\logs\DLMigration`

timmcmic commented 3 years ago

Start here.

https://timmcmic.wordpress.com/2021/04/25/4116/

Tim

dickfrazier commented 3 years ago

Thank you so much!!

timmcmic commented 3 years ago

@dickfrazier I went through and validated the mandatories. Exchange Online credentials were missing - but the rest of the validation checks checked out. I ran just the start command and filled in the requested attributes.

timmcmic commented 3 years ago

And actually I just corrected myself - they're intentionally not mandatory. Instead of using parameter sets because it became highly confusing i just used based validation code. For exchange online - there's two methods to authenticate. As of now when running _without_specifying parameters it does not prompt you for everything you need.

dickfrazier commented 3 years ago

Thanks! I make some real novice mistakes sometimes. I now understand that I need to set all the params after start-distributionlistmigration instead of being prompted for all of them or setting them in a file. I'm testing now 👍

timmcmic commented 3 years ago

Not all of them - part 1 lists the majors. They're kinda in groups.

So required -> mail, active directory, storage location, the OU to put them in, and one set of exchange online credentials (either app based or user name and password).

From there - it depends on what you want the script to do. If you want to shorten the migration time by having the script trigger a delta sync -> then you have to specify the ad connect information.

If you want to enable hybrid mail flow - then you need the exchange servers...

ETC...

dickfrazier commented 3 years ago

Is this understanding correct?: If I am not worried about the hybrid mail flow then it will function like V1 but not have to talk to the on prem exchange server?

dickfrazier commented 3 years ago

Also, thank you so much for putting so much time and energy into this and then also helping me understand everything, it is really generous

timmcmic commented 3 years ago

Correct - it has been re-written to be based off LDAP - for customers that no longer have Exchange do not need to enable hybrid mail flow. So you are correct - there's no reason to specify an exchange server if you do not require hybrid mail flow. As for V1 - this is a fairly major re-write the outcomes are the same but the mechanics are different.

dickfrazier commented 3 years ago

Making some real progress- it goes through and fails here:

image

Does that mean I need to add our internal domain to my accepted domains in 365 or is this when I need to use the -enablehybridmailflow? I think I would just rather have everything in 365, will adding the accepted domain do the trick?

timmcmic commented 3 years ago

Looks like you have an email address on the object that is not an accepted domain in Office 365.

dickfrazier commented 3 years ago

It was the subdomain that we use for the internal domain that caused the issue, we did not have accept from all subdomains configured so I added it as an accepted domain and an internal relay. I had added it after seeing the error once but it hadn't seen the change yet and errored again, running it a third time was successful, as have the other 8 DL's that I have done so far. About 70 to go! Thanks so much for your work

timmcmic commented 3 years ago

Fantastic. I think I may add a check for the accepted domains. It's a good idea - first time I've run into that but it's not terribly uncommon.

dickfrazier commented 3 years ago

One more thing that I found was that when it failed in that state I had to do some cleanup to re-run the script for that DL

  1. Delete the new DL that was created- there will now be a DL with just a testdl@orgname.mail.onmicrosoft.com address that is cloud based that must be deleted first (otherwise will fail with DL already exists error on re-run)
  2. Move the DL from the non-sync OU back to a normal OU
  3. Run a delta sync
  4. re-run script for the DL

image

timmcmic commented 3 years ago

That is correct.