Microsoft 365: PowerShell – How to enable / disable Knowledge Agents

Hi All,
Greetings for the day!!!
In the last article we discussed the new feature – Knowledge Agents. Microsoft 365 : Introducing Knowledge Agent (preview): AI-powered content optimization for SharePoint and Copilot
In this article, we will discuss how to enable or disable Knowledge Agents feature using PowerShell.
We use KnowledgeAgent parameters in Set-SPOTenant to enable Knowledge Agent across all sites or selectively exclude specific ones.
Prerequisites
- SharePoint Online Management Shell version 16.0.26413.12010 or later
- Microsoft 365 Copilot license
Detailed Steps
- Verify if require module “Microsoft.Online.SharePoint.PowerShell” is installed
- Check the required version is installed
- We will use Get-Module CMDLET
PS C:\> Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable -Verbose
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Online.SharePoint.PowerShell.
VERBOSE: Loading module from path 'C:\PowerShell\Modules\Microsoft.Online.SharePoint.PowerShell\16.0.26413.12010\Microsoft.Online.SharePoint.PowerShell.dll'.
Directory: C:\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Binary 16.0.2641… Microsoft.Online.SharePoint.PowerS… Desk
- Sometime, we didnt see complete version number.
- We could use only “Version” property to verify the version
PS C:\> $spo_version = Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable -Verbose
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Online.SharePoint.PowerShell.
VERBOSE: Loading module from path 'C:\PowerShell\Modules\Microsoft.Online.SharePoint.PowerShell\16.0.26413.12010\Microsoft.Online.SharePoint.PowerShell.dll'.
PS C:\> $spo_version.Version
Major Minor Build Revision
----- ----- ----- --------
16 0 26413 12010
PS C:\>

- From above CMDLET, we know that we have “SharePoint Online PowerShell” module version is – 16.0.26413
- NEXT, import the module: Microsoft.Online.SharePoint.PowerShell
We have detailed article to explore PowerShell modules. Please have a look once. https://knowledge-junction.in/2022/12/12/__trashed-2/
PS C:\> Import-Module -Name "C:\PowerShell\Modules\Microsoft.Online.SharePoint.PowerShell" -UseWindowsPowerShell
WARNING: The names of some imported commands from the module 'Microsoft.Online.SharePoint.PowerShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Microsoft.Online.SharePoint.PowerShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Microsoft.Online.SharePoint.PowerShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: Module Microsoft.Online.SharePoint.PowerShell is loaded in Windows PowerShell using WinPSCompatSession remoting session; please note that all input and output of commands from this module will be deserialized objects. If you want to load this module into PowerShell please use 'Import-Module -SkipEditionCheck' syntax.

- NEXT, Connect to our tenant using Connect-SPOService CMDLET
PS C:\> Connect-SPOService -Url https://knowledgejunction1-admin.sharepoint.com -Credential $Cred

- To enable / disable “Knowledge Agent” feature we will use “KnowledgeAgentScope ” parameter to Set-SPOTenant CMDLET
- Possible values for “KnowledgeAgentScope ” parameter
AllSites: Knowledge Agent is available on all sites.ExcludeSelectedSites: Knowledge Agent is available on all sites except those specified in KnowledgeAgentSelectedSitesList.NoSites: Knowledge Agent isn’t available on any sites. (This is the Default value.)
- We can verify current status of “Knowledge Agent” feature using Get-SPOTenant CMDLET as in code below
# Verify the configuration
Get-SPOTenant | Select-Object KnowledgeAgentScope
PS C:\> Get-SPOTenant | Select-Object KnowledgeAgentScope
KnowledgeAgentScope
-------------------
NoSites
PS C:\>

- From the above code output it seems “Knowledge Agent” feature is disabled in my local tenant
- As discussed, we can enable the “Knowledge Agent” feature using Set-SPOTenant CMDLET as in code below.
- In code below, we are enabling this feature for all sites.
PS C:\> Set-SPOTenant -KnowledgeAgentScope AllSites
Set-SPOTenant: You do not have the required license to perform this operation.
PS C:\>

- As in my development environment I do not have Microsoft 365 copilot license, I am getting an above warning.
REFERENCES
PowerShell – Exploring Module CMDLETs – https://knowledge-junction.in/2022/12/12/__trashed-2/
Get started with Knowledge Agent (preview) – https://learn.microsoft.com/en-us/sharepoint/knowledge-agent-get-started#enable-knowledge-agent
Thanks for reading 🙂 LIFE IS BEAUTIFUL 🙂
Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome to discuss.

You must be logged in to post a comment.