SharePoint / Guide 5

Troubleshooting

Common error messages and what actually fixes them.

On-premises

Symptom Likely cause Fix
The term 'Get-SPSite' is not recognized SharePoint cmdlets not loaded Add-PSSnapin Microsoft.SharePoint.PowerShell, or use SharePoint Management Shell
Cannot access the local farm Account lacks SharePoint_Shell_Access / not elevated Run as administrator; Add-SPShellAdmin (see Getting started, tip 4)
Access denied on a content DB in a script Shell admin granted on config DB only Add-SPShellAdmin -UserName ... -Database $db for each DB
"The attempted operation is prohibited because it exceeds the list view threshold" Query over 5,000 items without an index Index filter/sort columns; use folders or filtered views
Timer jobs stuck / servers out of sync Stale configuration cache Clear the config cache (SharePoint Server tips, tip 10)
Users report an error with a correlation ID Anything Get-SPLogsByCorrelation.ps1 -CorrelationId <id>
Content DB shows NeedsUpgrade = True after patching PSConfig not run, or failed Run PSConfig on each server; then Upgrade-SPContentDatabase
Shell memory keeps growing during a long script Undisposed SPSite/SPWeb Dispose in finally blocks or use Start-SPAssignment

SharePoint Online

Symptom Likely cause Fix
AADSTS700016 / application not found when running Connect-PnPOnline Using the retired shared PnP app Register your own app and pass -ClientId (Getting started, tip 2)
Connect-SPOService fails in PowerShell 7 Module compatibility Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell, or use Windows PowerShell 5.1
(429) Too Many Requests / (503) Server Unavailable Throttling Slow down, batch, run off-hours; PnP retries automatically
Access denied on Get-SPOUser for a site Not a site collection admin there Temporarily add yourself with Set-SPOUser -IsSiteCollectionAdmin $true
List view threshold error with Get-PnPListItem No paging Add -PageSize 500
Search doesn't show new columns/content Not crawled yet Request-PnPReIndexList / Request-PnPReIndexWeb
Storage still high after deleting versions/files Items are in the recycle bins Check first- and second-stage recycle bins; they count toward storage

General habits that prevent most problems

  • Run with -WhatIf first, and read what it says it will do.
  • Start a transcript before any change.
  • Test in a non-production site or farm.
  • Change one thing at a time, and write down what you changed.