Solved

Displayname property contains leading or trailing whitespace, which must be removed

Posted on 2007-11-21
8
3,576 Views
Last Modified: 2010-08-05
I have users that I cant migate to E2k7 due to this error.
i am not a scripter, and have found at http://www.exchangeninjas.com/RecipientValidation  - the code to fix it:
Get-Mailbox | Foreach { Set-Mailbox -Identity $_.Id -DisplayName $_.DisplayName.Trim() }

however I dont know how to apply htis to an individial user eg. named testuser.
Can someone help me with the excact code htat i need to type into EMS to perform this function.
Thanks, P.
0
Comment
Question by:prospatho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 19

Expert Comment

by:SteveH_UK
ID: 20333004
I recommend that you use Active Directory Users and Computers to make this change for a single user.

Navigate to the user in AD U&C and right click on the account.  Select rename.  Check the name is correct.  When you press Enter, you will be presented with a dialog box where you can make sure that all names have the correct format.
0
 
LVL 19

Accepted Solution

by:
SteveH_UK earned 250 total points
ID: 20333009
If you know the username but nothing else, you can search AD U&C for the user, using Windows 2003.  This feature wasn't in AD U&C in Windows 2000.
0
 

Author Comment

by:prospatho
ID: 20337415
Thaanks Steve, That was a much easier solution..
If anyone knows how to usev the script for future use id be grateful...
my concern is that is automatically sets off a batch process - or does it propmt for users?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 19

Expert Comment

by:SteveH_UK
ID: 20337533
The code offered is a PowerShell script.  You need to download and install it if you have an Exchange 2003 environment.  It is installed as part of Exchange 2007.

Basically, it works as follows:

1.  Retrieve the list of all mailboxes
2.  For each mailbox, do the following:
   a)  Set the display name property of the current object ($_) using the ID field to identify it ($_.Id)
   b)  To the value of the existing display name, after it has been trimmed ($_.DisplayName.Trim())

The Trim() function removes leading and trailing space from a string, so " Dave" becomes "Dave" and "Joey " becomes "Joey"

You can find loads of information on PowerShell at Microsoft TechNet (technet.microsoft.com).  It is a fairly new technology, and is designed to replace other scripting methods (for administration at least) in the future (such as scripting WMI, WSH, VBScript, batch files).
0
 
LVL 19

Expert Comment

by:SteveH_UK
ID: 20337537
You are right, it does this for every mailbox in the Exchange organisation.  No prompts!
0
 

Expert Comment

by:WILSON123J
ID: 25868609
I am getting issue when i try to install exchange mangement console with sp1 CD on my windows 2008 server.
 I am getting below error. I want to clarify whether "get-mailbox" command will work in powershell
 only after installing exchange mangement console. I am getting error when trying to  install
exchange 2007 server , it says leading or trailing spaces are there in 2003 exchange server
presently running. My plan is to install exchange 2007 on a new server and move mailobxes and
 remove 2003 exchange. My question is - if "get-maibox" command is to find the mailboxes with
leading/trailing spaces in existing exchange and due to this exchange management console is
 not getting installed. I understand that "get-mailbox" command will work only after installing
exchange manegment console. Here i am totally confused. Now i cannot install exchange manegement
 console because of white spaces and to check whitespace issue i need "get-mailbox" command where
 exchange management console should be there . Please explain this logic.


Summary: 3 item(s). 0 succeeded, 1 failed.
Elapsed time: 00:00:08
Organization Preparation
Failed
Error:
The Name property contains leading or trailing whitespace, which must be removed.
Error:
The Name property contains leading or trailing whitespace, which must be removed.
Elapsed Time: 00:00:08

Copy Exchange Files
Cancelled




Management Tools
Cancelled

0
 
LVL 13

Expert Comment

by:leegclystvale
ID: 26119222
This worked for me - ran it on Exch2007
Errors were all with Exch2003 users with a space after displayname. Worked like a charm...thank goodness as the template used for years had 1500 problematic users.
All hail powershell!!!
Get-mailbox | foreach {set-mailbox $_.identity -display
name $_.DisplayName.Trim() }
0
 
LVL 13

Expert Comment

by:leegclystvale
ID: 26119252
in fact, use this for over 1000 mailboxes etc otherwise you'll have to suss out the syntax and run it again.....like me!!
Get-mailbox -resultsize unlimited | foreach {set-mailbox $_.identity -displayname $_.DisplayName.Trim() }
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question