Wednesday, 13 June 2018

Forcing Synchronization of Display Name and Email from Active Directory without User Profile Synchronization - PowerShell Script

Just made this script to Synchronize Display Name and Email for all users in a root web if they have been updated in AD and aren't flowing through to your display name in SharePoint. This may be required if the user profile service is not set up or is failing. This problem is discussed in more detail at https://gallery.technet.microsoft.com/office/User-Information-List-in-8b420e8c

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#As discussed in https://gallery.technet.microsoft.com/office/User-Information-List-in-8b420e8c 

Write-Host  -ForegroundColor Yellow "-------------------Process Start---------------------------------------------------------------"
Write-Host  -ForegroundColor Yellow "This script will sync the AD display name and email from AD without running a user profile sync"
Write-Host  -ForegroundColor Yellow "As discussed in https://gallery.technet.microsoft.com/office/User-Information-List-in-8b420e8c" 
Write-Host  -ForegroundColor Yellow "-------------------Process Start---------------------------------------------------------------"

$stopWatch = [Diagnostics.Stopwatch]::StartNew()

$rootWeb = Get-SPWeb "https://demo01.berkeleyit.com/"
ForEach ($user in $rootWeb.AllUsers)
{
    Write-Host  -ForegroundColor Green "Syncing Email and DisplayName with Active Directory... for $user" 
    Set-SPUser -Web $rootWeb -identity $user.UserLogin -SyncFromAD
}

$stopWatch.Stop()

$timeTaken = $stopWatch.Elapsed

Write-Host  -ForegroundColor Yellow "-------------------Process Completed in $timeTaken second(s)------------------"

2 comments:

Arushi Chaya said...

I have really happy to these reading your post. This product control and maintenance of our health.The daily routine can assist you weight lose quickly and safely.My life is completely reworked once I followed this diet.I feeling nice concerning myself.

Herbalife in Chennai
Herbalife Nutrition Products
Nutrition centers in Chennai
Weight Loss in Chennai
Weight Gain in Chennai

sivasurya rg said...

Data science is a fast-moving field – if you’re pursuing a data science career, or even if you’re just interested in data-related topics, you need to invest time to keep up with the trends. Following a few top blogs is a great way to stay abreast of developments in data analysis, statistical software, data visualization, and more. These AUTOMATIONMINDS bloggers consistently offer great resources and tutorials, along with opportunities to connect with and learn from other leading data science professionals.
DATA SCIENCE training in chennai