Loading SharePoint Snap-In
suggest changeLoad the SharePoint snap-in with:
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
This works only in 64-bit Windows PowerShell. Snap-ins are not available in PowerShell 7. If the window title says “Windows PowerShell (x86)”, you are in the 32-bit host.
If the snap-in is already loaded, Add-PSSnapin errors. Load it only when it is missing:
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
Alternatively, if you start the SharePoint Management Shell, it will automatically include the Snap-In.
To list the SharePoint cmdlets:
Get-Command -Module Microsoft.SharePoint.PowerShell
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents