logo
search
Others

How to Troubleshoot SharePoint Server 2019 PowerShell Script Errors

Olivia MillerOlivia Miller Sep 29, 2026 869 views

Question details

The user needs to diagnose and resolve errors in SharePoint Server 2019 PowerShell scripts, including access-denied messages, object-not-found results, and skipped site collections.

How to Troubleshoot SharePoint Server 2019 PowerShell Script Errors
Product
SharePoint Server 2019
Device & OS
not provided
Scenario
Running administrative or automation PowerShell scripts via the SharePoint Management Shell.
Observed behavior
Scripts fail to execute properly, returning access-denied errors, reporting objects not found, or skipping specific site collections entirely.
Before you start

Ensure you have access to SharePoint Central Administration and are launching the SharePoint Management Shell with administrative privileges.

Solution 1Recommended

Grant Required Script Account Permissions

Farm administrator status alone may not provide all necessary permissions. You must grant specific access via the Web Application User Policy.

Many script failures occur because the executing account lacks explicit permissions on the target site collections, even if it is a farm administrator account.

1
Access Central Administration

Open SharePoint Central Administration and navigate to the 'Security' section.

2
Configure User Policy

Click on 'Configure Web Application User Policy' and select the target web application.

3
Grant Full Control

Add the account used to run the PowerShell script and grant it 'Full Control' where appropriate.

4
Add Site Collection Administrator

If necessary, navigate to the specific affected sites and manually add the script account as a Site Collection Administrator.

Grant Required Script Account Permissions
Permission Propagation: Allow a few moments for policy changes to apply across the web application before rerunning your script.
Free Microsoft Office alternative

Manage Your SharePoint Documents Seamlessly with WPS Office

While resolving server-side PowerShell script errors requires Microsoft administrative tools, WPS Office is an excellent, free alternative for creating, editing, and managing the actual documents stored within your SharePoint environment. It offers high compatibility and a lightweight design.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install WPS Office: Run the installer and follow the quick on-screen instructions to set up the suite on your device.
  3. 3. Open SharePoint Files: Download your documents from SharePoint and open them directly in WPS Writer, Spreadsheet, or Presentation to start editing.
Fully compatible with Microsoft Office formats (DOCX, XLSX, PPTX)Free, lightweight, and fast-loading office suiteFamiliar user interface ensuring a seamless migration for teamsPerfect for reviewing and editing files downloaded from SharePoint
microsoft office alternative - wps office

Frequently Asked Questions

Why does my script return 'access denied' if I am a farm administrator?

Farm administrator status grants access to Central Administration but does not automatically grant access to the content within all site collections. You often need to add the account to the Web Application User Policy with Full Control.

How do I check if a SharePoint site collection is locked?

You can check the lock status by running the Get-SPSite cmdlet in the SharePoint Management Shell and inspecting the 'ReadOnly' or 'LockIssue' properties of the site collection object.

Can I use standard Windows PowerShell instead of the SharePoint Management Shell?

While possible if you manually load the Microsoft.SharePoint.PowerShell snap-in, it is highly recommended to use the SharePoint Management Shell as it automatically loads the required cmdlets and configures the correct execution environment.