Fix PowerShell MFA Script Errors During Microsoft 365 Sign-In
Question details
Users experience script errors or blank authentication windows when connecting to Microsoft 365 or OneDrive using PowerShell commands with MFA.

- Product
- Microsoft 365, PowerShell, OneDrive
- Device & OS
- not provided
- Scenario
- Attempting to authenticate to Microsoft 365 services via PowerShell (e.g., Connect-MsolService) or logging into OneDrive.
- Observed behavior
- An authentication window appears displaying 'object doesn't support the includes property or method' or goes entirely blank after the user selects Yes.
Ensure you have administrator access to the machine experiencing the issue and verify your system has the latest Windows updates installed, as this updates the core WebView components used for modern authentication.
Update PowerShell Modules and Use Current Connection Methods
Microsoft continuously updates authentication flows. Using deprecated modules like MSOnline can trigger script errors. Transitioning to modern modules resolves most MFA issues.
Legacy PowerShell modules often rely on outdated Internet Explorer rendering engines to display the Microsoft 365 login screen. By updating to the latest Exchange Online Management module, you force PowerShell to use modern, compatible authentication windows.
Right-click the Start button and select 'Windows PowerShell (Admin)' or 'Terminal (Admin)' to run the console with elevated privileges.
Type 'Install-Module -Name ExchangeOnlineManagement -Force' and press Enter to download the latest Microsoft 365 management components.
Instead of using legacy commands like Connect-MsolService, type 'Connect-ExchangeOnline' and press Enter.
When the modern Microsoft 365 authentication prompt appears, enter your credentials and approve the MFA request as usual.

Update WebView2 and Browser Authentication Components
The blank authentication window or 'includes' script error is often caused by outdated rendering engines handling the MFA popup.
Isolate Network and Device Factors
Since the issue sometimes resolves on its own, it may be related to temporary network restrictions, VPN interference, or cached session data.
Switch to WPS Office for a Hassle-Free Productivity Experience
If complex PowerShell administration, Microsoft 365 authentication errors, or OneDrive sync issues are slowing down your productivity, consider WPS Office. It provides a lightweight, offline-capable, and completely free alternative that does not rely on complicated MFA scripts for basic document editing.
- 1. Download the installer: Visit the official WPS Office website and download the free installation package.
- 2. Install WPS Office: Run the installer and follow the simple on-screen instructions to set up the software on your computer.
- 3. Open your files: Double-click your existing Microsoft Office documents to open them instantly in WPS Office without needing complex authentications.

Frequently Asked Questions
Why does PowerShell show 'object doesn't support the includes property'?
This error typically occurs when the authentication window relies on an outdated rendering engine (like legacy Internet Explorer components) to process modern JavaScript used on Microsoft's MFA pages. Transitioning to modern PowerShell modules or updating WebView2 fixes this.
Why does my Microsoft 365 authentication window go blank?
A blank window after clicking 'Yes' often means the login script crashed or the network connection to the authentication server was interrupted. Ensuring your PowerShell modules are updated to the modern Connect-ExchangeOnline method generally prevents this.
Can a VPN cause PowerShell MFA script errors?
While not the primary cause of the 'includes' script error, VPNs can sometimes block or intercept the specific Microsoft authentication URLs needed for the modern popup, resulting in a blank screen. Disconnecting the VPN temporarily can help rule this out.
How do I fix the same script error happening in OneDrive?
Since OneDrive shares the same underlying authentication components as Microsoft 365, updating Microsoft Edge WebView2 Runtime and ensuring your Windows OS is fully updated will typically resolve the login errors for both PowerShell and OneDrive.




