NAME
Hello, I use Exchange 2007 and need to modify the "NAME" field for all user. The policy used is: Firstname LASTNAME (first letter of the firstname in capital and the rest in lower case following by a space and lastname in uppercase). I do not know if there is any command line/script allowing me to set that up for all users.. I thought about extracting firstame (get-mailuser -resultsize unlimited | select firstname) and use even Word...(sentence case).. But I believe power shell is enough powerful to make it work. Many thanks in advance, Graig
July 26th, 2011 5:43am

this is the wroing forum for you request please post it to the Exchange Forum. Thanks in advance. regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2011 11:34am

this is the wroing forum for you request please post it to the Exchange Forum. Thanks in advance. regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com @ Peddy1st, this is indeed the Exchange forum. :) @Graig, we can definitely help. I'm not quite sure what you're asking for though. You want to modify the display name for all users? You could use something like what I've described here: http://mikecrowley.wordpress.com/2010/12/14/script-for-missing-upns. If this is indeed the logic you're looking for, let me know and i can customize it for you. Mike Crowley | MVP My Blog -- Planet Technologies
July 26th, 2011 2:24pm

Thanks Mike, Maybe that below example should give you a better view of what I need. In fact, I need to modify the Name field and not the displayname. The hard part for me is to "tell" powershell to use the firstname and put the first letter in capital and the rest in lower case add a space and the lastname in upper case. In my company I have many accounts that have the filed name wrong. Instead of Firstname LASTNAME they have FiLA (for example - sor of abbreviation) Example: [PS] C:\>Get-Mailbox -Identity GRAIG007| fl SamAccountName : GRAIG007 DisplayName : LASTNAME FIRTSNAME Name : Firstname LASTNAME Let me know if you need any further information. Maybe I am not clear enough.
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2011 4:24pm

Try this (save as .ps1): #Clear the screen cls #Build an array of qualified users $MyUsers = Get-Recipient -Filter {Firstname -ne $null -and Lastname -ne $null} $MyUsers | foreach { #Create an uppercase variable for the last name $UserLastName = ($_.LastName).ToUpper() #Create an uppercase variable for the first name $UserFirstName = ($_.FirstName).Toupper() #Take the first letter from the first name $UserFirstInitial = $UserFirstName[0] #Create a variable with the rest of the letters in the first name $OtherLetters = ($UserFirstName).substring(1) #Ensure the other letters in the first name are lowercase $OtherLetters = ($OtherLetters).ToLower() #Putting it all together $CompleteName = $UserFirstInitial + $OtherLetters + " " + $UserLastName #Report to the screen Write-host Setting attribute for $CompleteName #Setting the user Set-User $_.identity -Name $CompleteName } BTW, this doesn't work if a user has a single initial as their firstname. Maybe you can find those ahead of time. I'm going to bed. :) Mike Crowley | MVP My Blog -- Planet Technologies
July 26th, 2011 9:08pm

Graig, how did that work for you? Mike Crowley | MVP My Blog -- Planet Technologies
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2011 8:29pm

Hi Graiggoriz, Any updates? It works in my test lab. Frank Wang
July 28th, 2011 5:06am

Thanks Mike it Worked!!! :-D Gr8 job
Free Windows Admin Tool Kit Click here and download it now
July 28th, 2011 9:19am

Great! It was fun building. Mike Crowley | MVP My Blog -- Planet Technologies
July 28th, 2011 11:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics