You should post your question in IIS7 - Extensibility. http://forums.iis.net/1042.aspx
I would be interested in the answer also, I tried a few tries and kept bumping up against an index error. Here is my code sample. I manually set it in the GUI to see what the value stored in the applicationHost.config. Here is what is stored.
<location path="Default Web Site">
<system.webServer>
<security>
<authentication>
<basicAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
Here is my code sample.
Dim objAuth As New Microsoft.Web.Administration.ServerManager
objAuth.Sites("Default Web Site").SetAttributeValue("basicAuthentication", False)
objAuth.CommitChanges()
This lists various commands in appcmd
appcmd list sites -config -?
C:\Windows\System32\inetsrv>appcmd list sites -config -?
ERROR ( message:-name
-id
-serverAutoStart
-bindings.[protocol='string',bindingInformation='string'].protocol
-bindings.[protocol='string',bindingInformation='string'].bindingInformation
-limits.maxBandwidth
-limits.maxConnections
-limits.connectionTimeout
-logFile.logExtFileFlags
-logFile.customLogPluginClsid
-logFile.logFormat
-logFile.directory
-logFile.period
-logFile.truncateSize
-logFile.localTimeRollover
-logFile.enabled
-traceFailedRequestsLogging.enabled
-traceFailedRequestsLogging.directory
-traceFailedRequestsLogging.maxLogFiles
-applicationDefaults.path
-applicationDefaults.applicationPool
-applicationDefaults.enabledProtocols
-virtualDirectoryDefaults.path
-virtualDirectoryDefaults.physicalPath
-virtualDirectoryDefaults.userName
-virtualDirectoryDefaults.password
-virtualDirectoryDefaults.logonMethod
-virtualDirectoryDefaults.allowSubDirConfig
-[path='string'].path
-[path='string'].applicationPool
-[path='string'].enabledProtocols
-[path='string'].virtualDirectoryDefaults.path
-[path='string'].virtualDirectoryDefaults.physicalPath
-[path='string'].virtualDirectoryDefaults.userName
-[path='string'].virtualDirectoryDefaults.password
-[path='string'].virtualDirectoryDefaults.logonMethod
-[path='string'].virtualDirectoryDefaults.allowSubDirConfig
-[path='string'].[path='string'].path
-[path='string'].[path='string'].physicalPath
-[path='string'].[path='string'].userName
-[path='string'].[path='string'].password
-[path='string'].[path='string'].logonMethod
-[path='string'].[path='string'].allowSubDirConfig
)
Steve Schofield
Windows Server MVP - IIS
http://weblogs.asp.net/steveschofield
http://www.IISLogs.comLog archival solution
Install, Configure, Forget