Forum Discussion
Praveen_KumarS
Oct 01, 2024Copper Contributor
How to do deployment of WSP Solution using PNP Powershell in SharePoint
Looking for sample code details for below mentioned using PNP PowerShell. -Uploading WSP file to Solution gallery of Classic SharePoint site -Installing Solution -Activating the solution -Apply t...
kyazaferr
Nov 13, 2024Steel Contributor
# Connect to the SharePoint site
Connect-PnPOnline -Url "https://yoursharepointsite" -UseWebLogin
# Upload WSP file to the Solution Gallery
$wspFilePath = "D:\CustomTemplate.wsp"
$wspFileName = "CustomTemplate.wsp"
# Upload the WSP file to the Solution Gallery
Add-PnPFile -Path $wspFilePath -Folder "Solutions" -Overwrite
Write-Host "WSP File uploaded successfully to Solution Gallery."
# Install the Solution
# Installing the solution
Install-PnPApp -Identity $wspFileName
Write-Host "Solution installed successfully."
# Activate the Solution
# Activating the solution
Enable-PnPApp -Identity $wspFileName
Write-Host "Solution activated successfully."
# Apply Custom Template to SharePoint Site
# The template GUID (change it to the actual template GUID)
$templateGUID = "{E7ED6200-07BF-42F8-94CB-F6560D080DFA}#SZ"
# Apply the template to the site
Set-PnPWeb -Template $templateGUID
Write-Host "Custom template applied successfully to the site."