Can anyone advise of how i can amend the below script and have the DLs create and set if these parameter values are blank in the csv (captured from a previous export of on-prem to recreate in EOL). It seems these parameters have to have a value in the CSV that is used to feed into the script to run correctly (i tested with bogus info and it works fine when there are values here).
I would just split the logic for creating the group from those attrubutes and have If statements checking if the value is null or not to update the group with a set-DistributionGroup command. You have two of them in the script already, if($importGroups) and if(!$check).
So just do If(!($ManagedBy)) { Set-DistributionGroup }
You can follow this up with if else statement to make it as granular as you want.
Note: Might want to hard code in a short sleep period if you do this. Sometimes if you do a set command right after creating the object, it wont find the object to modify