@{DisplayName=Firstname Lastname} needs to be just 'Firstname Lastname' because get-mailbox -identity '@{DisplayName=Firstname Lastname} won't work.
I've tried using the -replace cmdlet to remove text.
$Olduser = Get-MsolUser -all | Where-Object {$_.BlockCredential -eq $True -and $_.isLicensed -eq $false} | Select-Object displayName,userPrincipalName,BlockCredential,isLicensed
$OldUser | fl *
Using the -replace, I expected that the output will be without '@{DisplayName}'
Cannot process argument transformation on parameter 'Identity'. Cannot convert value "@{DisplayName=X X}" to type "Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter". Error: "Cannot conve
rt the "@{DisplayName=X X}" value of type "Deserialized.Selected.Microsoft.Online.Administration.User" to type "Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter"."
+ CategoryInfo : InvalidData: (:) [Get-Mailbox], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-Mailbox
+ PSComputerName : outlook.office365.com