Remove IIS Anonymous Access

Remove IIS Anonymous Access

am 19.04.2005 00:39:03 von bradleyj68

Does anyone know how to programmatically remove Anonymous Access from an IIS
web application? I'm assuming this can be done using WMI and Visual Basic
Script.

- Brad

Re: Remove IIS Anonymous Access

am 19.04.2005 08:01:34 von Bernard

You should able to tweak some of the sample scripts here -
http://www.microsoft.com/technet/scriptcenter/scripts/iis/ii s6/default.mspx

--
Regards,
Bernard Cheah
http://www.tryiis.com/
http://support.microsoft.com/
http://www.msmvps.com/bernard/


"Brad" wrote in message
news:F4059F66-A1D1-4FB6-A799-175794C9E47B@microsoft.com...
> Does anyone know how to programmatically remove Anonymous Access from an
> IIS
> web application? I'm assuming this can be done using WMI and Visual Basic
> Script.
>
> - Brad

RE: Remove IIS Anonymous Access

am 19.04.2005 08:55:01 von v-wdxu

Hi Brad,

Using script will be the simplest method for us on the management of IIS
programmatically. For seting the authentication in script, there is one
ADSI sample script:
'---------------------------------
'save the code as one vbs file
'---------------------------------

'the W3SVC/1/ROOT means the default web site of IIS (has the number 1)
'for other IIS sites in your server, please find the number of each site
from
'IIS MMC. It will lists all the site number when click the "Web Sites" node

Dim IIsObject
Set IIsObject = GetObject("IIS:///W3SVC/1/ROOT")
IIsObject.Put "AuthFlags", 4
IIsObject.Setinfo

WScript.Echo IIsObject.Get("AuthFlags")
'--end--------------------------

The code above use the method put to set the AuthFlags value. The value 4
means the Integreated Windows authentication method. The code
"IIsObject.Put "AuthFlags", 4" only sets the Integrated Windows
authentication method on this site. The anonymous authentication value is
1. If you are going to enable it with Integrated Windows authentication,
set 5 (4+1) to the AuthFlags. The value for all authentication methods are
listed below for you:
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/iissdk/html
/14b96ff9-94e6-49f4-8d61-160111041bd5.asp

At the folder scenrios>\inetpub\AdminScripts, there is one ADSI script "adsutil.vbs"
which can also help you on disabling the anonymous access. We can type the
command below to set the authentication.
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/1/root/Authflags 4

In addition, IIS provides many programmatic ways for us on the server
management: WMI/ADSI script, VB/C#/C++ etc all will be very helpful. The
detailed information is available from:
IIS Administration Technologies
http://msdn.microsoft.com/library/en-us/iissdk/html/d55288e7 -aa4c-49c9-ba3d-
4f10fc89e400.asp

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong XU
Microsoft Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.