Version History Issues

How to Enable SharePoint Versioning Using PowerShell with MFA

Ayan MasoodAyan Masood Nov 3, 2026 868 views

Question details

Administrators need a way to enable document versioning across multiple SharePoint sites in bulk using PowerShell while supporting MFA.

Enable SharePoint Versioning Using PowerShell and MFA
Product
Microsoft SharePoint Online
Device & OS
not provided
Scenario
Bulk enabling version history on SharePoint team sites and libraries when multifactor authentication is enforced on admin accounts.
Observed behavior
Standard PowerShell credential commands fail due to MFA restrictions, requiring an interactive authentication method to successfully run the versioning script.
Before you start

Ensure you have the latest SharePoint Online Management Shell or PnP PowerShell module installed, and always verify your script against a single test site before executing a bulk update.

Solution 1Recommended

Use Web Login Parameter in PowerShell

This method forces a browser-based authentication prompt that seamlessly handles multifactor authentication (MFA) requests during script execution.

When multifactor authentication is enabled, traditional credential passing in PowerShell will be blocked. To bypass this, you must instruct PowerShell to use modern web-based authentication.

Using the UseWebLogin parameter allows the script to trigger the standard Microsoft 365 login window, where you can complete your MFA approval via text, call, or authenticator app.

1
Prepare your bulk versioning script

Write or modify your PowerShell script to iterate through the target SharePoint team sites and update the EnableVersioning property on the document libraries.

2
Implement the UseWebLogin parameter

In your connection command (such as Connect-PnPOnline), add the -UseWebLogin parameter instead of -Credentials.

3
Execute and authenticate

Run the script. A standard Microsoft login dialog will pop up. Enter your credentials and approve the MFA request on your mobile device.

4
Verify the team sites

Check a sample of the updated team sites through the SharePoint admin center or web interface to ensure versioning was successfully enabled.

Use Web Login Parameter in PowerShell
Compatibility: This approach is fully compatible with team sites and ensures that conditional access policies are respected during administration.
Free Microsoft Office alternative

Manage and Edit Your Documents with WPS Office

While managing complex enterprise configurations like SharePoint versioning requires PowerShell expertise, everyday users and teams need an efficient, lightweight, and highly compatible office suite for creating and editing documents. WPS Office is a free, powerful alternative that seamlessly handles Microsoft Office formats and includes built-in document management features.

  1. 1. Download the Installer: Visit the official WPS Office website and click the free download button.
  2. 2. Install the Software: Run the downloaded installer file and follow the quick setup instructions.
  3. 3. Open Your Documents: Launch WPS Office and instantly open your existing Microsoft Office files without losing formatting.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats (.docx, .xlsx, .pptx).Includes intuitive built-in version history and local backup features to prevent data loss.Lightweight installation and low system resource consumption compared to bulkier office suites.User-friendly tabbed interface for managing multiple documents, spreadsheets, and PDFs in a single window.
microsoft office alternative - wps office

Frequently Asked Questions

Does the UseWebLogin method work on SharePoint team sites?

Yes, using the UseWebLogin or Interactive parameters fully supports connecting to and modifying settings on modern SharePoint team sites, provided the executing account has the necessary SharePoint Administrator permissions.

Why does standard PowerShell authentication fail when MFA is enabled?

Standard authentication passes a username and password directly without a user interface. MFA requires a secondary interactive verification (like an SMS or app approval), which is blocked by headless credential passing, resulting in an 'access denied' error.

Can I enable major and minor versioning simultaneously using PowerShell?

Yes, PowerShell scripts can be configured to enable both major versions (e.g., 1.0, 2.0) and minor/draft versions (e.g., 1.1, 1.2) by modifying the respective properties (EnableVersioning and EnableMinorVersions) of the SharePoint document library.

Is it possible to fully automate this script without interactive MFA prompts?

To fully automate scripts without user interaction while MFA is enforced across your organization, you must use app-only authentication with certificate-based access registered in Azure AD, rather than executing the script under a user account.