Hello,
We are using the version 2012.1
That explains everything :)
The Establish e-mail address in Exchange action appeared only in Adaxes 2013.1 that was dedicated to extended support of Exchange features. Adaxes 2012.1 didn't have such a Business Rule action.
As for the script, indeed you need to pass an Exchange Administrative Group as the 4th parameter. The thing is that starting from Exchange 2007, Microsoft dropped the most of support for Exchange Administrative Groups, leaving only one Administrative Group called Exchange Administrative Group (FYDIBOHF23SPDLT) by default. It is used mostly to support co-existance with older Exchange Servers. Before, Adaxes didn't take this into account and always required to pass an Administrative Group as the 4th parameter of the IAdmExchangeMailOps::MailEnable method regardless of Exchange version. Starting from Adaxes 2013.1, you don't need to pass it when Exchange 2007 or higher is used.
Since you have Adaxes 2012.1 installed, you'll need to pass the ADS Path of an Exchange Administrative Group to the script. However, since you are in an Exchange 2007 environment, the default Administrative Group Exchange Administrative Group (FYDIBOHF23SPDLT) can be simply hard-coded in the script. Here's a version of the script that should work with Adaxes 2012.1:
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$administrativeGroupPath = "Adaxes://CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com" # TODO: modify me
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")
# Bind to user object
$userDN = "CN=My Contact,CN=Users,DC=domain,DC=com" (I replaced this for the right ads path of my users)
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)
# Mail-enable the contact
$alias = $user.Get("Name") # Alias
$externalMailAddress = $user.Get("mail") # External e-mail address
$externalMailAddressType = "SMTP" # External e-mail address type
$user.MailEnable($alias, $externalMailAddress, $externalMailAddressType, $administrativeGroupPath)
In the script, $administrativeGroupPath specifies the ADS Path of the default Administrative Group. Replace DC=example,DC=com with the Distinguished Name (DN) of your AD domain.
Also, if you are going to use the script in a Business Rule, Custom Command or Scheduled Task, it can be reduced to only 5 lines:
$administrativeGroupPath = "Adaxes://CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com" # TODO: modify me
$alias = $Context.TargetObject.Get("Name") # Alias
$externalMailAddress = $Context.TargetObject.Get("mail") # External e-mail address
$externalMailAddressType = "SMTP" # External e-mail address type
$Context.TargetObject.MailEnable("test", "test@gmail.com", "SMTP", $administrativeGroupPath)