Advertisement
private775

Update user display name

Mar 5th, 2015
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ln = "AD\jdoe"
  2. $nm = 'Doe, John'
  3.  
  4. foreach($s in (Get-SPSite -Limit ALL)){
  5.     foreach($w in $s.AllWebs){
  6.         $cu = $w.AllUsers[$ln]
  7.         if($cu -ne $null){
  8.              if($cu.name -ne $nm){
  9.                  $w.Url
  10.                  Write-Host "Replacing $($cu.name) with $($nm)"
  11.                  $cu.DisplayName = $nm
  12.                  $cu.Update()
  13.              }
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement