# This script was originally published in the Exchange Cookbook,
# (http://www.exchangebookcook.com). Written by Paul Robichaux,
# Missy Koslosky, and Devin Ganger. Redistributed with permission
# of the publisher, O'Reilly & Associates.
# This code creates a new top-level address list
# ------ SCRIPT CONFIGURATION ------
use Win32::OLE;
$strDCName = '<serverName>';
# e.g. "batman"
$strContainer = '/CN=All Address Lists,CN=Address Lists Container,CN=<orgName>,CN=Microsoft Exchange,CN=Services,CN=Configuration,<domain>';
$strALName = '<newName>';
# e.g. Toledo Employees"
# ------ END CONFIGURATION ---------
$what = 'LDAP://' . $strDCName . $strContainer;
$objContainer = Win32::OLE->GetObject($what);
$objAddrList = $objContainer->Create('AddressBookContainer', 'cn=' . $strALName);
$objAddrList->Put('displayName', $strALName);
$objAddrList->Put('Instancetype', '4');
$objAddrList->Put('objectCategory', 'CN=Address-Book-Container,CN=Schema,CN=Configuration,DC=robichaux,DC=net');
$objAddrList->Put('PurportedSearch', '(&(mailNickname=*)(objectClass=user))');
$objAddrList->SetInfo();
|