Update SharePoint ActiveDirectory Group Displayname

When the name of an Active Directory group has been changed, this change won’t affect the display name showed in the SharePoint permission editor.

To update the the name for all Active Directory groups you can run this snippet on the SharePoint server:


if ((Get-PSSnapin 'Microsoft.SharePoint.PowerShell' -ErrorAction SilentlyContinue) -eq $null){Add-PSSnapin 'Microsoft.SharePoint.PowerShell'}

$SPSiteFilter = "https://sharepoint.domain.ch"

Get-SPSite | where{$SPSiteFilter -contains $_.Url} | %{

    $_.rootweb.siteusers | where{($_.DisplayName -ne $_.UserLogin) -and $_.IsDomainGroup} | %{

        Write-Host "Change: $($_.DisplayName) to: $($_.UserLogin)"

        $_.DisplayName = $_.UserLogin
        $_.Name = $_.UserLogin
        $_.Update()

    }
}

This snippet is part of my SharePoint default settings script: https://gist.github.com/7871902

Leave a Reply