Command
Add-SiteCollectionAdministrator
Description
This command automatically adds site collection administrator rights to your user account when you connect to a site.
Notes:
- You can use the Remove-SiteCollectionAdministrator command to remove the permission after your operation.
- Your site will be added to Explorer when the connection is made.
- Your user account will need to have sufficient permissions to be added as a site collection administrator.
- To grant this permission to multiple site collections or OneDrives, you can use a foreach loop or use the application.
Index
Examples
Add Site Collection Administrator rights on site
$site = Connect-Site -Url "http://myfarm1/sites/mysite" Add-SiteCollectionAdministrator -Site $site
Add Site Collection Administrator rights on site from the central administration
$centralAdminSite = Connect-Site -Url http://myfarm1:5000/
Add-SiteCollectionAdministrator -CentralAdmin $centralAdminSite -SiteUrl http://myfarm1/sites/mysite/
Add Site Collection Administrator rights on site from a tenant
$tenant = Connect-Tenant -Domain mytenant -Browser
Add-SiteCollectionAdministrator -CentralAdmin $tenant.Site -SiteUrl https://mytenant.sharepoint.com/sites/mysite/
Provision and populate One Drive for Business
$tenant= Connect-Site -Url https://mytenant-admin.sharepoint.com -Browser
$oneDriveUrl = Get-OneDriveUrl -Tenant $tenant -Email myuser@mytenant.onmicrosoft.com -ProvisionIfRequired
Add-SiteCollectionAdministrator -CentralAdmin $tenant.Site -SiteUrl $oneDriveUrl
$oneDrive = Connect-Site -Url $oneDriveUrl -UseCredentialsFrom $tenant
$dstList = Get-List -Name Documents -Site $oneDrive
Import-Document -SourceFolder \\mysharedrive\documentsToImport\ -DestinationList $dstList
Remove-SiteCollectionAdministrator -CentralAdmin $tenant.Site -SiteUrl $oneDriveUrl
Syntax
Add-SiteCollectionAdministrator -Site <Site>
Add-SiteCollectionAdministrator -CentralAdmin <Site> -SiteUrl <String>
Parameters
-CentralAdmin <Site>
Specifies the farm or tenant site for the transform.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | CentralAdmin |
Aliases | None |
-Site <Site>
Specifies the site to transform.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-SiteUrl <String>
Specifies the site to transform.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | CentralAdmin |
Aliases | None |