Grant Site Admin Privileges

Grant User Site Admin Privileges

The following PowerShell code can be used to promote a user to be a site administrator for a site collection. This should be run in the context of an account that has permission for this change.

$Web = Get-SPWeb http://webapp.com/sites/users-site 
$User – Get-SPUser -Web $Web -identity “i:05.t|saml provider|username@webapp.com” 
$User.IsSiteAdmin=$true 
$User.update()

Here are few other checks that can be run to assist the process –

After getting the web object with Get-SPWeb, check the claim string by using $Web.SiteUser with a filter, as shown here:

$Web.SiteUsers | ?{$_.UserLogin -like “*username*”} | ft -a

The results of that query shows the string which can be used in the Get-SPUser cmdlet. (Copy and paste saves some typing and can be more accurate.)

It is also possible to confirm that the user is a site admin by using this line in the appropriate location:

$User.IsSIteAdmin

(Results will be true of false.)

Advertisements
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: