Error finding PnP profile when executing Invoke-PnPSiteTemplate command

壹涵 雷 0 Reputation points

I followed the installation guide mentioned here and successfully connected to the SharePoint online tenant using the following PowerShell command:

Connect-PnPOnline https://<tenant>

Then, I executed the Invoke-PnPSiteTemplate command to apply the PnP Site Template, but encountered an error that the specified file does not exist. Upon searching, I found that the root directory did not exist at all.

I have attached the relevant error screenshots for reference.



A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,793 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,132 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 45,111 Reputation points

    The path ".\your-template-file.pnp" implies that you're using the current directory. If that's the root of the drive "D:", and the screenshot of file explorer (I'm assuming what it is) is of that drive then it shows that there's no such file there -- or that it's hidden or system file and you haven't configured the file explorer to show all files.

    Do you see the file when you run the cmdlet below?

    Get-ChildItem -Path D:\* -Force
    0 comments No comments

  2. Emily Du-MSFT 42,341 Reputation points Microsoft Vendor

    Please try to use below PnP PowerShell to apply theme for a SharePoint site.

    #Config Variables
    $SiteURL = ""
    $TemplateXML  ="D:\PnP-Theme.xml"
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Interactive
    #Apply provisioning Template
    Invoke-PnPSiteTemplate -path $TemplateXML

    Note: You should run PowerShell as administrator.

    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.