
Hi @Sebastian Biały ,
Welcome to Q&A forum!
The members you are talking about are members of the Microsoft 365 group. You can use the following code to add users to members tab in batches.
#Parameters
$SiteURL = "https://domain.sharepoint.com/sites/site"
$CSVFile = "C:\members.csv"
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Get the Site
$Site = Get-PnPSite -Includes GroupId
#Get Data from CSV
$CSVData = Import-CSV -Path $CSVFile
#Add users to the Site's associated Microsoft 365 Group Member
ForEach($Row in $CSVData)
{
Add-PnPMicrosoft365GroupMember -Identity $Site.GroupId -Users $Row.user
Write-host "Added Members to the Associated Microsoft 365 Group Successfully!" -f Green
}
}
Catch {
Write-host -f Red "Error:" $_.Exception.Message
}
For your reference:
https://www.sharepointdiary.com/2018/05/add-members-to-office-365-group-using-powershell.html
Note: non-official, just reference.
Hope this can help!
If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.