IIS and powershell forms authentication state

I am new to scripting and I have the task of creating a powershell script that will check and print the status of all authentication types of IIS 7.0 and 7.5 virtual directories.

As you probably know, there are 6 types of authentication (basic, windows, digest, forms, asp.net impersonation, anonymity).

For basic, windows, digest and anonymous I used this command:

Get-WebConfigurationProperty -filter /system.web/security/authentication -name enabled "IIS: \ Sites \ My Site \"

But I can not find a command that can verify the state for authentication using forms. Can you help me with this?

For example, if forms authentication is enabled in IIS Configuration Manager, I want to get the value in powershell that it is enabled.

Thank you very much.

+4
source share
2 answers

You can read the value of the mode attribute in the authentication configuration element:

(Get-WebConfiguration system.web/authentication 'IIS:\sites\Default Web Site').Mode 

These will be forms if the Authenticate Forms feature is enabled.

+2
source

If you are trying to get forms authentication for the main IIS panel, you can use below script ...

Get-WebConfiguration system.web / authentication -PSPath "MACHINE / WEBROOT" | Select-Object -ExpandProperty mode

If you are looking for a specific site, specify the path to the site / application.

+1
source

Source: https://habr.com/ru/post/1440634/


All Articles