0 votes

Can someone give me a PS script to enable-remotemailbox on on-prem exchange server using adaxes?

I have the following command working - but i'm thinking the -allowclobber may not be ideal...but without it it won't work.

$session = New-PSSession -ConfigurationName microsoft.exchange -ConnectionUri http://exchangeserver/PowerShell/
Import-PSSession $session -DisableNameChecking -AllowClobber

enable-remotemailbox "%username%" -remoteroutingaddress "%username%@tennantname.onmicrosoft.com" 

Remove-PSSession $session
by (340 points)

1 Answer

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


The AllowClobber parameter will replace the names of verbs in the cmdlets only in the current session that you create in your PowerShell script. However, if you feel inconvenient with this parameter, you can use the Prefix parameter to prefix all imported verbs with a certain prefix. In this case, when ncalling cmdlet in the remote session, you need to prefix the verbs as well. For example:

*$session = New-PSSession -ConfigurationName microsoft.exchange -ConnectionUri http://exchangeserver/PowerShell/
Import-PSSession $session -DisableNameChecking -Prefix MySession

Enable-MySessionRemoteMailbox "%username%" -remoteroutingaddress "%username%@tennantname.onmicrosoft.com"

Remove-PSSession $session*


Thanks for the great response! If you say I'm safe with the -allowclobber I'll stick with that. I didn't know if it would cause issues with other 365 commands that don't Remove-PSSession.

Related questions

0 votes
1 answer

How do I setup Adaxes for Exchange Online Hybrid mode? When I look at one of the users that has been migrated to Exchange Online I get the message of The operation couldn't be performed because object <user> couldn't be found on domain controller.

asked Dec 5, 2019 by Lucas.Miller (20 points)
0 votes
1 answer

Hi Team, I am looking to see if we can enable MFA for self service for specific users, I have enabled MFA for self service using the web configuratior sign on options, but that ... MFA for all the users. So wanted to check if this is a possibility, thank you.

asked Jul 9, 2021 by Vish539 (290 points)
0 votes
1 answer

Hi everyone, we're getting the below error when enabling a user for Lync: Connecting to remote server failed with the following error message : WinRM cannot process the request ... box' Lync enablement feature. Any ideas what might be going on? Thanks again!

asked Dec 6, 2013 by EgotisticalGiraffe (350 points)
0 votes
1 answer

Hi We are experiencing problems with the "Enable the user for Lync" function: Enable the user for Lync (Pool: 'lync-server.domain.local', SIP URI: 'sip:%mail%') Processing ... Help topic. This is for a managed domain, not the one Adaxes is installed in.

asked Oct 31, 2013 by kjesoo (960 points)
0 votes
0 answers

Adaxes version: 2018.2 I am attempting to setup a connection to a different forest and am having some issues. We have an Exchange 2013 server environment setup and when ... / -Credential $cred Any suggestions that you can give would be fantastic. Thank you.

asked Jul 22, 2019 by adowns (70 points)
3,071 questions
2,784 answers
434,102 users