Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Configuration
$WebUrl = "http://teams.contoso.com/sites/team1"
$SiteAdminGroup = "CONTOSO\ContosoSiteAdmins"
# Set the AD group as site collection administrator
$Web = Get-SPWeb $WebUrl
$SiteAdminUser = $Web.EnsureUser($SiteAdminGroup)
$SiteAdminUser.IsSiteAdmin = $true
$SiteAdminUser.Update()
@aflyen

This comment has been minimized.

Copy link
Owner Author

@aflyen aflyen commented Feb 12, 2016

In SharePoint it is not supported to add a AD security group as a primary or secondary site collection owner. In provisioning solutions it can be a good practice to have a group of admins with access to all sites for support the owners.

@irwins

This comment has been minimized.

Copy link

@irwins irwins commented Jun 8, 2016

Hi aflyen,

THis is exactly what I'm looking for! Having a Role-Based Delegation Model in place is a better way to grant/deny sysadmin rights to a site.
I'm unfamiliar with the cmldet Get-SPWeb. I did find a Get-SPOWebTemplate (guessing it's not the same).

Could you give me a link where I can find this cmdlet? Thanks

Rg./Irwin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.