Add-PnPSiteCollectionAdmin

Adds one or more users as site collection administrators to the site collection in the current context

Syntax

Add-PnPSiteCollectionAdmin
   -Owners <UserPipeBind>
                             [-Connection <SPOnlineConnection>]

Description

This command allows adding one to many users as site collection administrators to the site collection in the current context. It does not replace or remove existing site collection administrators.

Examples

------------------EXAMPLE 1------------------

Add-PnPSiteCollectionAdmin -Owners "user@contoso.onmicrosoft.com"

This will add user@contoso.onmicrosoft.com as an additional site collection owner to the site collection in the current context

------------------EXAMPLE 2------------------

Add-PnPSiteCollectionAdmin -Owners @("user1@contoso.onmicrosoft.com", "user2@contoso.onmicrosoft.com")

This will add user1@contoso.onmicrosoft.com and user2@contoso.onmicrosoft.com as additional site collection owners to the site collection in the current context

------------------EXAMPLE 3------------------

Get-PnPUser | ? Title -Like "*Doe" | Add-PnPSiteCollectionAdmin

This will add all users with their title ending with "Doe" as additional site collection owners to the site collection in the current context

Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Owners

Specifies owner(s) to add as site collection administrators. They will be added as additional site collection administrators to the site in the current context. Existing administrators will stay. Can be both users and groups.

Type:UserPipeBind
Position:Named
Accept pipeline input:True
Accept wildcard characters:False