title: PowerShell, SharePoint: Get-PnPSiteTemplate Error
body: <p>i am getting an error using PnP PowerShell cmdlet: Get-PnPSiteTemplate. I am a global admin and site collection admin as well.</p>
  <p>Custom Scripts are enabled:</p>
  <p>set-sposite <a href="https://tenant.sharepoint.com/sites/TestSite" rel="nofollow noreferrer">https://tenant.sharepoint.com/sites/TestSite</a> -denyaddandcustomizepages $false</p>
  <pre><code>Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/TestSite -Interactive
  
  Get-PnPSiteTemplate -Out &quot;C:TempDemo.xml&quot;
  
  Get-PnPSiteTemplate : Attempted to perform an unauthorized operation.
  At C:\Users\userX\Desktop\Script.ps1:3 char:1
  + Get-PnPSiteTemplate -Out &quot;C:TempDemo.xml&quot;
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : WriteError: (:) [Get-PnPSiteTemplate], ServerUnauthorizedAccessException
      + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Site.GetSiteTemplate
  </code></pre>
  <p>Anyone an idea? MS says PnP is open source, so no really support...</p>
  <p>Goal is to copy a complete SharePoint list with all items and meta data to anothe site. Like this:
  <a href="https://www.drware.com/copy-a-list-with-list-items-to-another-site/" rel="nofollow noreferrer">https://www.drware.com/copy-a-list-with-list-items-to-another-site/</a></p>
  <p>Thanks! :)</p>