Question

Sorry about the non-descriptive title; Had no Idea how to put it. So when I run the following code in command prompt

%systemroot%\system32\inetsrv\appcmd.exe list config "Default Web Site/Local\Service" -section:system.webServer/security/authentication/windowsAuthentication /clr:4

I get a snippet of xml back which includes

<WindowsAuthentication enabled="false authPersistNonNTLM="true">

I want to enable windows authentication for this service so I then run

%systemroot%\system32\inetsrv\appcmd.exe set config "Default Web Site/Local/service" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost 

If I rerun the orignal list command it is still returning that the windowsAuthentication enabled state is false. The set command is working correctly and enabling/disabling the windowsAuthentication which I check by going into IIS Manager. I figured the set and list should be modifying or returing the same value. I need to get the list working (or some other similar command) because I need to check the state of the authentication for my services. So the question is am I missing something? Why do the set and list appear to be working of two different values, and how can I get this command (or a similar command) to return the enable state for a services authentication that I see in IIS Manager?

I'm running IIS 7 by the way. Not sure if that makes a difference or not. Sorry if I've left out any other required details. Not that familiar with IIS.

Cheers in advance

Was it helpful?

Solution

The appcmd tool is sensitive to slashes.

In the list option, make sure you only use forward slashes otherwise the information returned will be from the first matching default and not the location you asked for.

%systemroot%\system32\inetsrv\appcmd.exe list config "Default Web Site/Local/Service" -section:system.webServer/security/authentication/windowsAuthentication /clr:4
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top