Publish an S/Mime certificate to AD via Powershell

An Outlook for Windows user can choose Option -> Trust Center -> Trust Center Settings -> eMail Security and then Publish to GAL to publish his S/Mime certficiate to the Active Directory environment. However this option is currently missing in Outlook for MAC.

So if such a user wish to publish his certificate into the ActiveDirectory, the user need to use a Windows PC. But thats not always possible, so here is an powershell part which can be used to publish an S/Mime certificate to the ActiveDirectory without MS Outlook: