How do I deploy an assistant to multiple SharePoint Sites with PowerShell?
This guide helps you deploy the LearnWise assistant web part to multiple SharePoint sites with the same configuration, saving time compared to manual deployment.
3 min readUpdated
On this page
Prerequisites #
- LearnWise app installed in your SharePoint tenant app catalog
- SharePoint administrator access
- LearnWise web part manually configured on at least one site (follow this guide)
Step 1: Install PowerShell #
Install PowerShell #
Follow Microsoft's official instructions to install PowerShell for your operating system: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell
Install PnP PowerShell Module #
Open PowerShell and run:
Install-Module -Name PnP.PowerShell -Scope CurrentUser
When prompted, type Y to confirm the installation.
Step 2: Connect to SharePoint #
Connect to your SharePoint tenant using PnP PowerShell:
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/your-site" -Interactive
Replace yourtenant with your SharePoint tenant name and your-site with the site where you manually configured LearnWise.
A browser window will open for authentication. Sign in with your SharePoint administrator account.
Step 3: Extract Web Part Configuration (One-Time) #
After manually configuring the LearnWise web part on a template site, extract its configuration to reuse across multiple sites.
# Get the page containing your configured LearnWise web part
$Page = Get-PnPPage -Identity "Home.aspx"
# List all web parts on the page to find LearnWise
$Page.Controls | Select-Object Title, InstanceId
# Get the LearnWise web part (replace with your exact title)
$WebPart = $Page.Controls | Where-Object {$_.Title -like "*LearnWise*"}
# Extract and save the configuration
$ConfigJSON = $WebPart.PropertiesJson
$ConfigJSON | Out-File -FilePath "learnwise-config.json" -Encoding UTF8
# Verify the configuration was saved
Get-Content "learnwise-config.json"
Important Notes:
- Replace
"Home.aspx"with the actual page name where LearnWise is configured - Replace
"LearnWise"with the exact web part title if different - The configuration file
learnwise-config.jsonwill be saved in your current directory - Keep this file - you'll use it to deploy to other sites
Step 4: Deploy Web Part to Multiple Sites #
Now deploy the LearnWise web part with the same configuration to multiple sites.
# Load the saved configuration
$LearnWiseConfig = Get-Content "learnwise-config.json" -Raw
# Define sites and pages to deploy to
$deployments = @(
@{Site="https://yourtenant.sharepoint.com/sites/site1"; Page="Home.aspx"},
@{Site="https://yourtenant.sharepoint.com/sites/site2"; Page="Home.aspx"},
@{Site="https://yourtenant.sharepoint.com/sites/site3"; Page="Welcome.aspx"}
)
# Deploy to each site
foreach ($deployment in $deployments) {
try {
# Connect to the site
Connect-PnPOnline -Url $deployment.Site -Interactive
# Get the page
$Page = Get-PnPPage -Identity $deployment.Page
# Get LearnWise component
$Component = $Page.AvailablePageComponents() | Where-Object {$_.Name -like "*LearnWise*"}
# Add web part with saved configuration
Add-PnPPageWebPart -Page $deployment.Page -Component $Component -Section 1 -Column 1 -WebPartProperties $LearnWiseConfig
Write-Host "✓ Successfully deployed to $($deployment.Site)" -ForegroundColor Green
}
catch {
Write-Host "✗ Failed on $($deployment.Site): $($_.Exception.Message)" -ForegroundColor Red
}
}
Configuration Options:
- Site URLs: Update the
$deploymentsarray with your actual SharePoint site URLs - Page Names: Specify which page to add LearnWise to (e.g., "Home.aspx", "Welcome.aspx")
- Section and Column: Modify
-Section 1 -Column 1to change where the web part appears on the page- Section: The section number on the page (1, 2, 3, etc.)
- Column: The column within that section (1 for left, 2 for right in two-column layouts)
Troubleshooting #
"Specified method is not supported" error #
Add the -Browser parameter to force browser authentication:
Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/site" -Interactive -Browser
Web part not found #
Ensure the LearnWise app is installed on the target site:
Get-PnPApp | Where-Object {$_.Title -like "*LearnWise*"}
If not installed, install it first:
$App = Get-PnPApp -Scope Tenant | Where-Object {$_.Title -like "*LearnWise*"}
Install-PnPApp -Identity $App.Id
Cannot find the page #
List all pages to verify the page name:
Get-PnPPage | Select-Object Name
Permission issues #
Ensure you have:
- Site collection administrator access on all target sites
- SharePoint administrator role in your tenant
Next Steps #
After deploying, verify that:
- The LearnWise web part appears on each target page
- The configuration (assistant settings, appearance) matches your template
- The assistant responds correctly when tested
Still stuck?
Ask the LearnWise assistant. It answers from these guides.
Related guides
- How do I publish an assistant into Microsoft Sharepoint?Build your assistant
- How can I add AI Student Tutor within Blackboard?Build your assistant
- How do I install AI Campus Support on the Brightspace Login Page?Build your assistant
- How do I publish an assistant in Blackboard via the Ultra Extension Framework (UEF)?Build your assistant
- How do I publish an assistant into Microsoft Teams?Build your assistant