Consider the following scenario:
- You are using the IIS web administration module for creating and managing IIS web applications with PowerShell scripts.
- You are running Windows Server 2008 R2.
- You are using New-WebApplication or ConvertTo-WebApplication cmdlets.
In this scenario, your scripts run much slower in PowerShell 4.0 than in PowerShell 2.0.
This issue does not occur if you run the same scripts in Windows Server 2012 or later.
If possible, migrate to Windows Server 2012 or later. Some cmdlets run much faster in PowerShell 4.0 in a Windows Server 2012 environment or later.
To work around this behavior, run PowerShell by using the -mta switch:
As another workaround, run PowerShell by using the -version 2 switch:
Powershell.exe -version 2
Article ID: 3144309 - Last Review: Apr 29, 2016 - Revision: 1