PS Script Help - Remove Trailing spaces from DisplayName attribute
good day,
looking little here. had cross forest domain user migration (from .local proper domain). many (not all) user accounts' displayname attribute has 3 - 7 trailing spaces behind them. can infant ps user script can run fix / remove these trailing spaces? appreciated.
hi kenn,
we call act of removing leading , trailing whitespaces on string "trimming" string. try this:
get-aduser -filter "*" -properties displayname | %{ set-aduser -identity $_ -displayname $_.displayname.trim() }
we retrieve users, each set displayname own, trimmed displayname.
cheers,
fred
there's no place 127.0.0.1
Windows Server > Windows PowerShell
Comments
Post a Comment