Well, I’m actually already there.
The below script should be simple. First line reads in users (I’ve tried both
alias and UPN) from a pre-generated text file. Second line iterates through the
collection and sets an Exchange-specific AD property. Or is supposed to. these
users are spread through several different databases on several different
servers all within the same forest. The account under which I am running the
script is both a Domain and Exchange Enterprise admin. Environment is Server
2008 R2 and Ex2010.
If I run it as-is each user line errors out with:
The operation couldn't be performed because object '<user UPN redacted>'
couldn't be found on '<some other server>'.
+ CategoryInfo : NotSpecified: (0:Int32) [Set-Mailbox],
ManagementObjectNotFoundException
+ FullyQualifiedErrorId :
736F1C0C,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
And every iteration references the same server (at least the foreach is
properly looping through the dataset) even though, as I said, the whole list is
spread out on different servers and databases.
If I run the second line manually by itself and put in the alias or UPN the
error is:
WARNING: The command completed successfully but no settings of '<canonical name
of user>' have been modified.
And sure enough the setting was not modified. I don’t have enough hair left to
keep ripping it out!
The script:
$user = get-content -path "c:\admin\abgusers.txt"
foreach ($item in $user) {Set-Mailbox -identity $item -OfflineAddressBook "ABG
Offline Address List"}