Share via

Error finding PnP profile when executing Invoke-PnPSiteTemplate command

壹涵 雷 0 Reputation points
2024-05-10T13:42:29.7766667+00:00

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

Connect-PnPOnline https://<tenant>-admin.sharepoint.com/

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.

0f411885-27b9-4121-817a-0905a194816c

f334b55f-1cfd-47dc-9eda-1ce1b55b0748

Microsoft 365 and Office | SharePoint | For business | Windows
Windows for business | Windows Server | User experience | PowerShell

2 answers

Sort by: Most helpful
  1. Emily Du-MSFT 51,986 Reputation points Microsoft External Staff
    2024-05-13T07:44:45.24+00:00

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

    #Config Variables
    $SiteURL = "https://tenant.sharepoint.com/sites/emilytest"
    $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.

    Was this answer helpful?

    1 person found this answer helpful.

  2. Rich Matheisen 48,116 Reputation points
    2024-05-10T15:22:46.0133333+00:00

    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
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.