Nov 17 2019 05:43 AM
Nov 17 2019 07:26 AM
What kind of help are you looking for? From what I gather from your description, you simply need three cmdlets, and their use is very straightforward. You don't even need to add any input logic as PowerShell will ask you for the missing information. So something like this would work:
$contact = New-MailContact
$DG = New-DistributionGroup
Add-DistributionGroupMember $dg.PrimarySmtpAddress -Member $contact.ExternalEmailAddress
Now of course you might want to add some additional infromation, input controls if you think they are necessary, error handling and so on. There are multiple examples available online on how to do that, look them up and start playing with the cmdlets, that's the best way to learn PS.