locked
IIS powershell performance RRS feed

  • Question

  • User-508150234 posted

    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

    1.0.0.0 WebAdministration

    Wednesday, July 24, 2019 2:49 PM

Answers

  • User-848649084 posted

    Hi,

    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?

    Regards,

    Jalpa

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, July 25, 2019 3:29 AM

All replies

  • User-848649084 posted

    Hi,

    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?

    Regards,

    Jalpa

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, July 25, 2019 3:29 AM
  • User-508150234 posted

    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.

    Thursday, July 25, 2019 8:30 AM