Skip to content

Latest commit

 

History

History
100 lines (74 loc) · 3.49 KB

Add-PnPSiteCollectionAdmin.md

File metadata and controls

100 lines (74 loc) · 3.49 KB
Module Name schema applicable online version external help file title
PnP.PowerShell
2.0.0
SharePoint Online
PnP.PowerShell.dll-Help.xml
Add-PnPSiteCollectionAdmin

Add-PnPSiteCollectionAdmin

SYNOPSIS

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

SYNTAX

Add-PnPSiteCollectionAdmin [-Owners <System.Collections.Generic.List<[PnP.PowerShell.Commands.Base.PipeBinds.UserPipeBind]>>] [-PrimarySiteCollectionAdmin <PnP.PowerShell.Commands.Base.PipeBinds.UserPipeBind>] [-Verbose] [-Connection <PnPConnection>]

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. You must be a Site Collection Admin to run this command. Use Set-PnPTenantSite -Owners if you are not an Admin for the site but have the SharePoint Online admin role.

EXAMPLES

EXAMPLE 1

Add-PnPSiteCollectionAdmin -Owners "[email protected]"

This will add [email protected] as an additional secondary site collection administrator to the site collection in the current context

EXAMPLE 2

Add-PnPSiteCollectionAdmin -Owners @("[email protected]", "[email protected]")

This will add [email protected] and [email protected] as additional secondary site collection administrator to the site collection in the current context

EXAMPLE 3

Get-PnPUser | Where-Object Title -Like "*Doe" | Add-PnPSiteCollectionAdmin

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

EXAMPLE 4

Add-PnPSiteCollectionAdmin -PrimarySiteCollectionAdmin "[email protected]"

This will set [email protected] as the primary site collection administrator of 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: PnPConnection
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Owners

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

Type: System.Collections.Generic.List`1[PnP.PowerShell.Commands.Base.PipeBinds.UserPipeBind]
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-PrimarySiteCollectionAdmin

The user to set as the primary site collection administrator. This will replace the current primary site collection administrator. To add additional site collection administrators, use the -Owners parameter.

Type: PnP.PowerShell.Commands.Base.PipeBinds.UserPipeBind
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

RELATED LINKS

Microsoft 365 Patterns and Practices