We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

IIS powershell performance [Answered]RSS

2 replies

Last post Jul 25, 2019 08:30 AM by llarsson

  • IIS powershell performance

    Jul 24, 2019 02:49 PM|llarsson|LINK

    I have performance issues with powershell integration. Is following scenario known? Workaround or information on how to troubleshoot performance?

    The first instance I am looking at where it becomes slow is:

    Powershell prompt 1)
    ConvertTo-WebApplication -ApplicationPool $pool $path
    Set-ItemProperty $path -Name enabledProtocols -Value "http,net.tcp"

    # Slow - repeatable slow - taking seconds to complete the following query:

    Get-WebApplication -Site "Default Web Site" -Name $path2

    Powershell prompt 2)

    # Faster than prompt 1 - immediate response

    Get-WebApplication -Site "Default Web Site" -Name $path2

    > $PSVersionTable.PSVersion

    Major Minor Build Revision
    ----- ----- ----- --------
    5 0 10586 117 WebAdministration

  • Re: IIS powershell performance

    Jul 25, 2019 03:29 AM|Jalpa Panchal|LINK


    This issue occurs because the New-WebApplication and ConvertTo-WebApplication cmdlets generate a high volume of COM calls. 

    To work around this behavior, run PowerShell by using the -mta switch:

    Powershell.exe -mta

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

    Powershell.exe -version 2

    Could you share which operating system you are using?



    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: IIS powershell performance

    Jul 25, 2019 08:30 AM|llarsson|LINK

    Thought it happen on like all our servers but now that I checked I can only see it on 2008R2 (2 out out 4-5 checked) - at least that scale less than 1 second vs around 6-16 seconds.

    Thanks been bugging me a few times over the year.
    The version seems more scare, the -mta workes for this issue on 2008R2. So thanks one big slow down is fixed.