0 votes

Hello,

I have a sheduled task running. This task checks if a user is a member of a Licensed Office 365 Group with exchange online. screenshot1.png

If the user does not have an exchange mailbox it should create the on premise mailbox and the remote mailbox.

Everything is working but if the user is created, the user is in the licensed group and in that moment an ad sync is running the user recieves automatically an exchange online mailbox.

If my script runs to late he will not recieve an on premise mailbox because of course he alredy has an exchange online mailbox.

Doy you know what I can add to check if a user only has exchange online mailbox it should also create also the on premise mailbox?

This is the powershell script:

$session = New-PSSession -ConfigurationName microsoft.exchange -ConnectionUri http://namexxx/PowerShell/ Import-PSSession $session -DisableNameChecking -Prefix MySession Enable-MySessionRemoteMailbox "%username%" -remoteroutingaddress "%username%@namexxx.mail.onmicrosoft.com" Remove-PSSession $session

Should I insted use the adaxes office 365 licensing? If I give a user a Exchange Online license does it automatically create the on prem exchange mailbox and the exchange online mailbox?

Thanks if you have an idea!

by (380 points)

1 Answer

0 votes
by (288k points)
selected by
Best answer

Hello Fabian,

You can use the following script from our repository to check whether a user has a mailbox in Exchange Online: https://www.adaxes.com/script-repository/check-whether-user-has-mailbox-in-exchange-online-s303.htm.

0

Hello,

I need to check if the milbox is in exchange online and exchange on prem. If it's only existing in exchange online it should create the mailbox also on prem because we run our exchange in hybrid mode.

+1

Hello Fabian,

As we understand, you are using group-based licensing for Microsoft 365 and need to enable remote mailboxes for users that get licensed through those 4 groups. The easiest way to do that is using a business rule triggering After adding a member to a group. It will allow you to skip all the extra checks and running the whole thing on a schedule. The rule will look like the following: image.png If you still prefer using a scheduled task, then it should be configured as follows: image.png

0

Hello, the first option with the buisness rule would be perfect. I tried but after triggering the buisness rule it tells me the following error:

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "" to type "Microsoft.Exchange.Configuration.Tasks.UserIdParameter". Error: "Parameter values of type Microsoft.Exchange.Configuration.Tasks.UserIdParameter can't be empty. Specify a value, and try again. Parameter name: identity" 2023-02-27 13_10_40-cpub-FARM_HOL-FARM_HOL-CmsRdsh - tsweb.rubner.com - Remotedesktopverbindung.png

It seems like adaxes does not give to my script the necessary userinformation because the buisness rule is triggered on a groupobject and not on a userobject. Am I right?

+1

Hello Fabian,

Yes, you are right. You can use the below script:

$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me

$user = $Context.BindToObject("Adaxes://%member%")
$user.EnableRemoteMailbox($remoteRoutingAddressTemplate)

Related questions

0 votes
1 answer

Hello, We are using adaxes with a M365 hybrid environment and right now we have to manually create a remote mailbox on prem after user creation. ... -Identity "user@mydomain.com" -ExternalEmailAddress "user@mydomain.onmicrosoft.com" Enable-RemoteMailbox "user"

asked Oct 16, 2020 by copatterson (70 points)
0 votes
1 answer

I need a Scheduled Task that send an email of a list of all users that have an on prem mailbox. I have found the script to check if the mailbox is on prem but have not found the way to build and email the list. It can be in CSV fomat.

asked Jul 5, 2019 by hgletifer (1.3k points)
0 votes
0 answers

When attempting to assign licenses during the "after creating a user" rule we're reciving the following error. Failed to create a remote mailbox for the user. The address ' ... mail attribute to the proper format that isn't the onmicrosoft.com domain as well.

asked Sep 2, 2021 by zorps (20 points)
0 votes
1 answer

Hi all, I got a script that works, but is kinda finicky: $memberListProperty = "adm-CustomAttributeTextMultiValue1" try { $records = $Context.TargetObject.GetEx($memberListProperty) } ... = "fraisalan.ch" } Thank you for your help! Best regards Benjamin

asked Oct 17 by basshunter98 (20 points)
0 votes
1 answer

I connected my local AD domain as well as my Entra domain in Adaxes, however I am now seeing duplicate user accounts, one under our local AD and the other from ... Connect, and it's confusing determining which user is in which location when making updates.

asked Sep 4 by aswint (50 points)
3,542 questions
3,233 answers
8,227 comments
547,808 users