How to update "Enabled Protocols" settings for a web application in IIS, using PowerShell script

Thasaiyan, Jeganathan 5 Reputation points
2023-11-16T04:45:07.7066667+00:00

How to update "Enabled Protocols" settings for a web application in IIS, using PowerShell script. Please refer the snapshot for more details.

enabledprotols

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,504 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,445 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 46,551 Reputation points
    2023-11-16T19:30:54.1133333+00:00

    Try this:

    Import-Module IISAdministration -Force          # you may not need to explicitly load this module
    $site = Get-IISSite -Name "<site-name-name-goes-here>"
    $app = $site.Applications | 
                Where-Object {$_.Path -eq "<application-path-goes-here>"}   # has leading /
    [string]$protos = $app.EnabledProtocols
    $protos += ",<additional-protocol-goes-here"    # NOTE LEADING COMMA! the list is a string of comma separated values
    $app.EnabledProtocols = $protos
    $m = Get-IISServerManager
    $m.CommitChanges()
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.