none
unable to provision site along with storage quota? Please help me? RRS feed

  • General discussion

  • I am using one of the article shared by a person to create multiple sites using PNP template. I did some modifications, but still it is throwing errors while creating. Moreover it is creating all those sites without storage quota. Can you please help on how to loop through and assign storage quota too? Moreover I have to import CSV file multiple times, 1 for creating site and another for applying template. can you please help me out to fix this too? 

    #Prompt for Tenant url $myHubsite = "https://m365x539190.sharepoint.com/sites/ourclients" $cred = Get-Credential $TenantUrl = https://m365x539190-admin.sharepoint.com Connect-pnpOnline -url $TenantUrl -Credentials $cred #$TenantUrl = Read-Host -Prompt 'Enter your SharePoint online tenant url' #Connect-pnpOnline -url $TenantUrl $siteCollectionList = Import-Csv -Path "C:\raj\powershell\Sites.csv" #Loop through csv and provision site collection from each csv entry foreach ($siteCollection in $siteCollectionList) { $SharePointUrl = $siteCollection.Url $SiteOwner = $siteCollection.Owner $Title = $siteCollection.Title $Template = $siteCollection.SiteTemplate $TimeZone = $siteCollection.TimeZone $StorageQuota = $siteCollection.StorageQuota #Create site collection based on values above New-PnPTenantSite -Owner $SiteOwner -Title $Title -Url $SharePointUrl -Template $Template -TimeZone $TimeZone --StorageQuota $storgaeQuota } $siteCollectionList1 = Import-Csv -Path "C:\raj\powershell\Sites.csv" foreach ($site in $siteCollectionList1) { Connect-PnPOnline -Url $site.Url -Credentials $cred Apply-PnPProvisioningTemplate -Path C:\raj\PowerShell\template1.xml Add-PnPHubSiteAssociation -Site $site.SiteUrl -HubSite $myHubsite }

    Moreover it is throwing a warning that "The source site from which the template was generated had a base template ID value of STS#3, while the current target site has a base template 

    ID value of TENANTADMIN#0. This could cause potential issues while applying the template'

    I did mentioned in my CSV file template as "STS#3", not sure why I am seeing that warning. I did exported template from the site which is of "STS#3" only.

    Tuesday, January 28, 2020 9:56 PM

All replies

  • Just import the CSv into a variable and use that.  That is what the code does.  There is no need to import it twice.

    Note that this forum is not set up to teach your PowerShell or to fix code you have copied from the Internet.   Please ask the author of the script for help.

    I recommend that you take time out to learn basic PowerShell.


    \_(ツ)_/


    • Edited by jrv Tuesday, January 28, 2020 10:33 PM
    Tuesday, January 28, 2020 10:32 PM