locked
IIS does not recognize Windows authentication via PowerShelll RRS feed

  • Question

  • User623077956 posted

    I am trying to update the status of Windows authentication in IIS, I tried to execute with the command:

    "Set-WebConfigurationProperty -Filter "/system.webServer/security/authentication/windowsAuthentication" -Name Enabled -Value True -PSPath "IIS:\Sites\$SiteName\$AppName"

    but I get the error:

    WARNING Property Enable is not found on /system.webServer/security/authentication/windowsAuthentication

    Microsoft Authentication works and is installed on the machine I am working on, I would love if someone got a solution

    Sunday, May 23, 2021 9:08 AM

All replies

  • User1065476709 posted

    Hi anwarjutt,

    but I get the error:

    WARNING Property Enable is not found on /system.webServer/security/authentication/windowsAuthentication

    You can try enable windows authentication and disable anonymous authentication and try again.

    $iisSiteName = "Default Web Site"
    $iisAppName = "MyApp"
    
    Write-Host Disable anonymous authentication
    Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/anonymousAuthentication' -Name 'enabled' -Value 'false' -PSPath 'IIS:\' -Location "$iisSiteName/$iisAppName"
    
    Write-Host Enable windows authentication
    Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/windowsAuthentication' -Name 'enabled' -Value 'true' -PSPath 'IIS:\' -Location "$iisSiteName/$iisAppName"

    Best regards,

    Sam

    Monday, May 24, 2021 2:11 AM