IIS Authentication [Answered]RSS

1 reply

Last post Jan 25, 2014 06:57 AM by ShayL

  • IIS Authentication

    Jan 24, 2014 01:06 PM|smurteira7|LINK

    I would like to be able to list authentication (Windows, Anonymous, Basic, Forms) for my websites and applications under each website.  Can someone help.  This is what I have so far.

    get-website | select name,id,state,physicalpath, @{n="Bindings"; e= { ($_.bindings | select -expa collection) -join ';' }} ,@{n="LogFile";e={ $_.logfile | select -expa directory}} | ft -AutoSize
    
    Get-WebApplication | ft -AutoSize

    Thanks

    powershell

  • Re: IIS Authentication

    Jan 25, 2014 06:57 AM|ShayL|LINK

    There might be a better way but you can start with this:

    $Bindings = @{n='Bindings'; e= { ($_.bindings | select -expa collection) -join ';' }}
    $LogFile = @{n='LogFile';e={ $_.Logfile.Directory}}
    $AnonymousAuth = @{n='AnonymousAuth';e={(Get-WebConfiguration -PSPath "IIS:\Sites\$($_.Name)" -Filter system.webServer/security/authentication/anonymousAuthentication).Enabled}}
    $BasicAuth = @{n='BasicAuth';e={(Get-WebConfiguration -PSPath "IIS:\Sites\$($_.Name)" -Filter system.webServer/security/authentication/basicAuthentication).Enabled}}
    $ClientCertificateMappingAuth = @{n='ClientCertificateMappingAuth';e={(Get-WebConfiguration -PSPath "IIS:\Sites\$($_.Name)" -Filter system.webServer/security/authentication/clientCertificateMappingAuthentication).Enabled}}
    $DigestAuth = @{n='DigestAuth';e={(Get-WebConfiguration -PSPath "IIS:\Sites\$($_.Name)" -Filter system.webServer/security/authentication/digestAuthentication).Enabled}}
    $IisClientCertificateMappingAuth = @{n='IisClientCertificateMappingAuth';e={(Get-WebConfiguration -PSPath "IIS:\Sites\$($_.Name)" -Filter system.webServer/security/authentication/iisClientCertificateMappingAuthentication).Enabled}}
    $WindowsAuth = @{n='WindowsAuth';e={(Get-WebConfiguration -PSPath "IIS:\Sites\$($_.Name)" -Filter system.webServer/security/authentication/windowsAuthentication).Enabled}}
    
    Get-Website | Select-Object Name,Id,State,PhysicalPath,$Bindings,$LogFile,$AnonymousAuth,$BasicAuth,$ClientCertificateMappingAuth,$DigestAuth,$IisClientCertificateMappingAuth,$WindowsAuth

    powershell

    -shay