Module Name | schema | applicable | online version | external help file | title |
---|---|---|---|---|---|
PnP.PowerShell |
2.0.0 |
SharePoint Online |
PnP.PowerShell.dll-Help.xml |
Add-PnPSiteCollectionAdmin |
Adds one or more users as site collection administrators to the site collection in the current context
Add-PnPSiteCollectionAdmin [-Owners <System.Collections.Generic.List<[PnP.PowerShell.Commands.Base.PipeBinds.UserPipeBind]>>] [-PrimarySiteCollectionAdmin <PnP.PowerShell.Commands.Base.PipeBinds.UserPipeBind>] [-Verbose] [-Connection <PnPConnection>]
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.
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
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
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
Add-PnPSiteCollectionAdmin -PrimarySiteCollectionAdmin "[email protected]"
This will set [email protected] as the primary site collection administrator of the site collection in the current context
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
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
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