Hi @sns ,
To execute pnptracelog you have to run Set-PnPTraceLog -On -Level:Debug
before Get/Apply command.
With Get-PnPSiteTemplate
command you could generates a provisioning site template from a web.
PowerShell commands:
1.Get-PnPSiteTemplate
#Set variables
$SiteURL = "https://xxx.sharepoint.com/sites/xxx"
$SchmaXMLPath = "C:\Temp\SiteSchema.xml"
#Connect to PnP Online
Connect-PnPOnline -Url $siteUrl -Interactive
#Get Site Schema
Get-PnPSiteTemplate -Out ($SchmaXMLPath) -PersistBrandingFiles -PersistPublishingFiles
2.Invoke-PnPSiteTemplate
#Set variables
$SiteURL = "https://crescent.sharepoint.com/sites/projects/morocco"
$SchmaXMLPath = "C:\Temp\SiteSchema.xml"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Apply Pnp Provisioning Template
Invoke-PnPSiteTemplate -Path $SchmaXMLPath -ClearNavigation
For Reference: How to Copy a Site in SharePoint Online using PowerShell
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept 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.