i would like to create a single script to enable or to function the above needs.
You could put them into one script directly, they will be run in order. Such as:
Get-User -OrganizationalUnit E2K16MBX | Where-Object {$.recipientType -eq "user" -and $.Company -eq "cloudnine"} | Enable-Mailbox -Database "DB01EX01"
$Users = Get-User -OrganizationalUnit Off365mbx | Where-Object {$.recipientType -eq "user" -and $.WindowsEmailAddress -like "$null" }
$users | % {Enable-RemoteMailbox -Identity $ -RemoteRoutingAddress((($.UserPrincipalName.split("@")[0])) +"@cloudnine.mail.onmicrosoft.com")}
also there are scenario's where application mailboxes should not be create any type mailboxes either on-prem servers or Off365 mailboxes
About this one, you could set a value for those application mailboxes, such as set the value of Department as "Application", then you will could use this value to exclude these mailboxes:
Get-User -OrganizationalUnit ToOnline | Where-Object {$_.recipientType -eq "user" -and $_.Department -ne "Application"}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.