Adding Members to Communities via PowerShell Script

Share on print
Share on facebook
Share on linkedin
Share on whatsapp
Share on email

Empower your Appspace Intranet with streamlined community membership management through the PowerShell command line.

This article provides Administrators with an outline of tools and knowledge to effortlessly automate the process of adding members to communities, saving time and enhancing efficiency. 

Prerequisites

  • The Global Administrator user role with Windows Server Administrator permissions.
  • Ensure PnP PowerShell version 1.3 or later is installed. Please visit the PowerShell official site for information regarding installation, upgrading from legacy versions.

Add Members to Communities via PowerShell Script

Important
For WSP Appspace Intranet Release Package installation models, you’ll need to execute the PowerShell Script from the Web Front End (WFE) server.

Run PowerShell as administrator, and proceed to execute the following PowerShell script from the Deployment files folder:

.beezy-AddMembersToGroup.ps1 -SiteCollectionUrl <beezy-sitecollection_url> -GroupId <beezy_group_id> [-ADGroup <groupname>] [-CsvFile <filepath>]

Mandatory parameters

-SiteCollectionUrl <beezy-sitecollection_url> Appspace Intranet site collection URL.
-GroupId <beezy_group_id> Appspace Intranet place (community) ID number. You can get the number from the community URL.
-AzureADAppConfigCsvPath
( Intranet version <= 4.13.0 )
Specify the path of a .csv file with the “BeezyM365” Microsoft Entra ID application information needed to use Intranet API.

You can get this .csv file by executing beezy -GetAzureADAppConfigCsv.ps1

-EntraIDAppConfigCsvPath
( Intranet version >= 4.14.0 )
Specify the path of a .csv file with the “BeezyM365” Microsoft Entra ID application information needed to use Intranet API.

You can get this .csv file by executing beezy -GetEntraIDAppConfigCsv.ps1

Optional parameters (source)

-ADGroup <groupname> Specify the AD Group Name if you want to add users from an AD Group as Community members.
-CsvFile <filepath> Specify the path of a .csv file if you want to add users from a CSV file as Community members.

If no source is specified, the source will be the Appspace Intranet database itself.

CSV File Template

For On-Premise deployments, ensure the “username” header is included in the .csv file when adding members.

username
user1
user2
user3

For Cloud deployments, ensure the “username” header is included in the .csv file when adding members.

username
user1@domain.com
user2@domain.com
user3@domain.com

Examples

Below is a list of SharePoint script examples when adding members from the following sources:

Appspace Intranet database:

.beezy-AddMembersToGroup.ps1 -SiteCollectionUrl http://portal.b13qa.local -GroupId 4641

.beezy-AddMembersToGroup.ps1 -SiteCollectionUrl https://beezyqa.sharepoint.com/sites/beezy -GroupId 952

CSV file:

.beezy-AddMembersToGroup.ps1 -SiteCollectionUrl http://portal.b13qa.local -GroupId 4641 -CsvFile c:tempusers.csv

AD Group:

.beezy-AddMembersToGroup.ps1 -SiteCollectionUrl http://portal.b13qa.local -GroupId 4641 -ADgroup b13qaallpeople

.beezy-AddMembersToGroup.ps1 -SiteCollectionUrl https://beezyqa.sharepoint.com/sites/beezy -GroupId 952 -ADgroup allusers

Related Articles