I use the trim function anytime I import text. $a=$a.trim IIRC. Rick
From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Daniel Chenault Sent: Tuesday, January 21, 2014 4:56 PM To: Scripting Subject: RE: [scripting] driving me nuts As it turned out Powershell itself is the culprit. I had generated the user list using get-aduser with an LDAP filter. The output (which I had only looked at in Notepad) had been padded with trailing spaces. So of course "u...@domain.com<about 20 spaces><mailto:u...@domain.com%3cabout%2020%20spaces%3e>" did not exist. I HATE gotchas!!! But don't we all? ________________________________ From: dani...@hotmail.com<mailto:dani...@hotmail.com> To: scripting@lists.myITforum.com<mailto:scripting@lists.myITforum.com> Subject: [scripting] driving me nuts Date: Tue, 21 Jan 2014 02:08:52 -0800 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<mailto:redac...@pacific-inc.com>>' 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"}