I would recommend a slightly different approach if maintaining IIS 7 or 7.5. The concepts are similar but de-emphasizing the ASP.Net oriented <system.web> in the local application web.config in trade for emphasizing the IIS oriented <system.webServer> in the server applicationHost.config.
Start at the bottom of this link and scroll up...
http://www.iis.net/ConfigReference/system.webServer/security/authentication/windowsAuthentication
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim anonymousAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Default Web Site/App1")
anonymousAuthenticationSection("enabled") = False
Dim windowsAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Default Web Site/App1")
windowsAuthenticationSection("enabled") = True
serverManager.CommitChanges()
End Sub
End Module
The core approach is to make changes in IIS Manager and observe how the application host config changes for that application. Then you replicate those changes by driving the new Microsoft.Web.Administration assembly appropriately.
Location: %systemroot%\system32\inetsrv\config\applicationHost.config
Things to look for:
<location path="Default Web Site/App1">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>