Avatar of vbchewie
vbchewie
Flag for United States of America

asked on 

A constraint violation occured. (Exception fomr HRESULT:0x8007202F

I am trying to write a PowerShell Script to and New Users to my domain.  I am using virtual organization as instructed by http://technet.microsoft.com/en-us/exchange/bb936719.aspx
One of the requirements to get the separate GAL to function properly is to change the msExchQueryBaseDN value.  I am using the following code to change the value but I get the following error.

Exception calling "CommitChanges" with "0" argument(s): "A constraint violation
 occurred. (Exception from HRESULT: 0x8007202F)"
At E:\Exchange Server\Scripts\NewUser.ps1:191 char:20
+ $user.CommitChanges( <<<< );

Please Advise,
#=============================
# Mailbox Confirmation Section
#=============================
 
$a1 = get-mailbox $UserAlias
$a2 = $a1.name
$a3 = $a1.addresslistmembership
$a4 = $a1.OfflineAddressBook
$a5 = $a1.userprincipalname
$a6 = $a1.organizationalunit
$a7 = $a1.customattribute1
$a8 = $a1.distinguishedname
$a10 = $a1.emailaddresses
 
"11 of 14, Setting msExchQueryBaseDN"
#To Bind:
$user = ([ADSI]"LDAP://$a8").psbase;
#To Modify:
$user.Properties["msExchQueryBaseDN"].Value = "ou=$a7,ou=Companies,dc=contoso,dc=com";
$user.CommitChanges();
 
$a9 = $user.Properties["msExchQueryBaseDN"]
$a9b =$user.Properties["memberof"]

Open in new window

Exchange

Avatar of undefined
Last Comment
BSonPosh

8/22/2022 - Mon