Some IIS administration cmdlets run slowly in PowerShell 4.0


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.


This issue occurs because the New-WebApplication and ConvertTo-WebApplication cmdlets generate a high volume of COM calls. By default, PowerShell 4.0 runs in the STA threading model. PowerShell 2.0 runs in the MTA threading model.


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:

Powershell.exe -mta

As another workaround, run PowerShell by using the -version 2 switch:

Powershell.exe -version 2

Microsoft Internal Support Information

Steps to reproduce.

Product Bug Number:
Author ID (email alias):
Writer ID(email alias):
Tech Review ID (email alias):
Editor: v-tiburd
Confirm Article has been Tech Reviewed: Yes/No
Confirm Article released for Publishing: Yes/No

Article ID: 3144309 - Last Review: Apr 29, 2016 - Revision: 1