Skip to content

Mail-enabling groups

The following code sample mail-enables a group.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the group
$groupDN = "CN=My Group,CN=Users,DC=domain,DC=com"
$group = $admService.OpenObject("Adaxes://$groupDN", $NULL, $NULL, 0)

# Mail-enable the group
$alias = "%sAMAccountName%" # Alias

$group.MailEnable($alias, $NULL, $NULL, $NULL)

See also