AD user modify

I have 2000 Users. Need to modify the Lastname & Displayname. Both the attributes have the “service” keyword & that need to be replaced with “sales” keyword from both the attributes.
I dont want to put completely new value. Just need to replace the a word form them.

I have tried but that is replaced the entire value.

Try this, just remember to change $OU and $Filter.

[Pre]
$Filter = ‘DisplayName -Like “service” -and Surname -Like “service”’
$OU = ‘OU=MyOrg,DC=simonw,DC=se’

Get-ADUser -Filter $Filter -SearchBase $OU -Properties DisplayName | Foreach-Object {
$NewDisplayName = $.DisplayName -replace ‘service’, ‘sales’
$NewSurName = $
.Surname -replace ‘service’, ‘sales’
Set-ADUser -Identity $_ -DisplayName $NewDisplayName -Surname $NewSurname
}

Sure & thanks a ton. Will updat eyou shortly.