running a powershell script from custom attributes

running a powershell script from custom attributes

we run a hybrid system with O365. In order for new O365 users to be included in our global address book where we run exchange 2010 server, we have to run a powershell command to enable-remotemailbox -remoteroutingaddress, like so:

Enable-RemoteMailbox %userName% -RemoteRoutingAddress %userName%@domain.mail.onmicrosoft.com


we have this in the custom scripts run box. 

powershell.exe -noexit c:scriptsenablemail.ps1 


we have added the appropriate snapins and connections to the standard PS profile the admanger/user runs as. 


Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
. $env:ExchangeInstallPathinRemoteExchange.ps1

Connect-ExchangeServer -auto


when we create a new user, the custom script status says that it is still running in the background, we wait and wait, but the users are never added to the address book on our exchange server. 


we arent sure we are running the powershell script in the correct way, is there documentation that shows what arguments the custom script will accept? or does anyone have any other work arounds?  

                New to ADManager Plus?

                  New to ADSelfService Plus?