Hi
Try this
For single user:
get-user "user1" | ?{ $_.Lastname -neq $null } | %{ $dispName=$_.LastName + ", " + $_.FirstName ; set-mailbox $_.SamAccountName -Displayname $dispName }
For All users:
get-user | ?{ $_.Lastname -neq $null } | %{ $dispName=$_.LastName + ", " + $_.FirstName ; set-mailbox $_.SamAccountName -Displayname $dispName }