I was trying to create new Site collection in my SharePoint online tenant with O365 group. So I have come across following commands from PnP PowerShell.

New-PnPSite allows us to create O365 group with Site Collection. So I was trying to create multiple site collection from CSV. That CSV does contain information about Owners of the site. So when I try following command after authenticating to PnPOnline single line code works as below:

New-PnPSite -Type TeamSite -Title "0ABC Test" -Alias "0abctest" -Description "some desc" -Owners "[email protected]","use[email protected]","[email protected]" -Lcid 1033

Above code will create new O365 group and also adds those user mentioned as a owner of the group. This command will also create site collection.

But when I try it by reading Owners from CSV file as below (Sample CSV):

122 Dev Test,122DevProject,[email protected],"[email protected]";"[email protected]";"[email protected]",Private

new site never adds owner, it always shows empty. Below is my PS Code:

foreach ($row in $table) #$table is my CSV object
    [array]$owners = $row.OWNERS.split(";")
    [string]$stringOwners = $null
    $stringOwners = '"{0}' -F ($owners -join '",')
    $stringOwners = $stringOwners.Replace('""', '"')
    $stringOwners = $stringOwners.Trim(',')

    New-PnPSite -Type TeamSite -Title $row.DisplayName -Alias $row.Alias -Description $row.DisplayName -Owners $stringOwners -Lcid 1033

So my question is how can we add multiple user for New-PnPSite reading owners from CSV file. Is this really possible? Am I missing something here?

Any help would be much appreciated.


1 Answer 1


The type for -Owners parameter should be String[].

You could try the below script:

    [String[]]$owners= $row.OWNERS.replace('"','').split(";")
 New-PnPSite -Type TeamSite -Title $row.DisplayName -Alias $row.Alias -Description $row.DisplayName -Owners $owners -Lcid 1033

The $owners value should be like this:

enter image description here

  • Thank you @Michael but when I tried this it didn't add users to the Group. Group was empty.
    – Pradip R.
    Aug 25, 2020 at 10:07
  • Hi, I just tested on my end. This worked for me. Users are added to the Ownwers Group. What's the value of $ownwes? Please check my updated answer, the value should be like that. Aug 27, 2020 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.