Skip to content

O365EmailAddressPolicy PowerShell module replicates Exchange On-Premise functionality when it comes to Email Address Policy allowing cloud-only environments. Office 365 doesn't provide an option to autogenerate email addresses for users. This module enables the creation of email addresses for users based on their first name and last name.

License

Notifications You must be signed in to change notification settings

EvotecIT/O365EmailAddressPolicy

Repository files navigation

O365EmailAddressPolicy - PowerShell Module

O365EmailAddressPolicy PowerShell module replicates Exchange On-Premise functionality when it comes to Email Address Policy allowing cloud-only environments. Office 365 doesn't provide an option to autogenerate email addresses for users. This module enables the creation of email addresses for users based on their first name and last name.

Installing

Everyone can install this module from PowerShellGallery hosted by Microsoft. It's recommended way to work with the module. Version on PowershellGallery is optimized for speed and signed. Using code from GitHub is recommended for development.

Install-Module -Name O365Essentials -AllowClobber -Force

Force and AllowClobber aren't necessary, but they do skip errors in case some appear.

Updating

Update-Module -Name O365Essentials

That's it. Whenever there's a new version, you run the command, and you can enjoy it. Remember that you may need to close, reopen PowerShell session if you have already used module before updating it.

The essential thing is if something works for you on production, keep using it till you test the new version on a test computer. I do changes that may not be big, but big enough that auto-update may break your code. For example, small rename to a parameter and your code stops working! Be responsible!

Usage

# will give [email protected]
Get-EmailAddress -FirstName 'Przemysław' -LastName 'Kłys' -EmailTemplate "%g%[email protected]" -ToLower
$EmailTemplate = @(
    "%g.%[email protected]"  # will give [email protected]
    "%1g.%[email protected]" # will give [email protected]
    "%1g%[email protected]"  # will give [email protected]
    "%3g.%[email protected]" # will give [email protected]
    "%g.%[email protected]" # will give [email protected]
    "%[email protected]"     # will give [email protected]
)

Get-EmailAddress -FirstName 'Przemysław' -LastName 'Kłys' -EmailTemplate $EmailTemplate -ToLower

About

O365EmailAddressPolicy PowerShell module replicates Exchange On-Premise functionality when it comes to Email Address Policy allowing cloud-only environments. Office 365 doesn't provide an option to autogenerate email addresses for users. This module enables the creation of email addresses for users based on their first name and last name.

Topics

Resources

License

Stars

Watchers

Forks