Assigning a ABP via list using PowerShell

Copper Contributor

We are trying to assign a group of users an  Address Book Policy via PowerShell.


I have created a list with the UPN for test account. I am using the following commands:


$NAK = Get-Content "C:\Downloads\ABP2023.txt"

$NAK | foreach {Set-Mailbox -Identity $_ -AddressBookPolicy "Student-ABP"}


The error message that I am getting is:


WARNING: The command completed successfully but no settings of '*' have been modified.
Write-ErrorMessage : Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|The operation couldn't be performed because object ' ' couldn't
be found on 'YT3PR01A12DC005.CANPR01A012.PROD.OUTLOOK.COM'.
At C:\Users\*\AppData\Local\Temp\tmpEXO_nremjsjq.r2l\tmpEXO_nremjsjq.r2l.psm1:1188 char:13
+ Write-ErrorMessage $ErrorObject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-Mailbox], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=YQXPR01MB2568,RequestId=3a58a503-1622-abab-97f0-4231d97a10ea,TimeStamp=Tue, 19 Sep 2023 18:49:48 GMT],Write-ErrorMessage

2 Replies
It looks like the cmdlet is passing an empty value, so check your txt file. Making use of the -WhatIf parameter helps with testing such scenarios.

@Vasil Michev 


The text file has the UPN for the account.