Code Comments
Programming Forum and web based access to our favorite programming groups.I am looking for a method to *programatically* add/remove Identities from an IIS 5 (Win2k) server. Manually, this is done via the Props window of the web site in question (via the Advanced button in the Web Site Identification area of the Web Site tab). Specifiy the IP Address, Port and Host Header and you're good to go. I need to do this via script, shell or some other programable way. Any ideas? TIA Steve
Post Follow-up to this messageHi,
Try doing a search on "Using ADSI to Configure IIS", this is only one of
many ways of doing it, but probably the one you're after.
Beginner code might look a bit like this [shoddy example from the
Microsoft docs]:
' Create an instance of the virtual directory object
' that represents the default Web site.
Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")
' Use the Windows ADSI container object "Create" method to create
' a new virtual directory.
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir", "NewVDir")
' Use the Windows ADSI object "Put" method to
' set some required properties.
IIsWebVDirObj.Put "Path", "C:\NewContent"
IIsWebVDirObj.Put "AccessRead", True
IIsWebVDirObj.Put "AccessScript", True
' Use the AppCreate2 method of the IIS ADSI provider to
' create an application on the new virtual directory.
IIsWebVDirObj.AppCreate2 1
IIsWebVDirObj.Put "AppFriendlyName", "NewApp"
' Use the Windows ADSI object "SetInfo" method to
' save the data to the metabase.
IIsWebVDirObj.SetInfo
Steven Frank wrote:
> I am looking for a method to *programatically* add/remove Identities from
an
> IIS 5 (Win2k) server.
>
> Manually, this is done via the Props window of the web site in question (v
ia
> the Advanced button in the Web Site Identification area of the Web Site
> tab). Specifiy the IP Address, Port and Host Header and you're good to go
.
> I need to do this via script, shell or some other programable way.
>
> Any ideas?
>
> TIA
> Steve
>
>
--
Gerry Hickman (London UK)
Post Follow-up to this messageThanks, but I'm not trying to create a virtual directory. An "identity"
really has nothing to do with virtual directories.
Anyone else?
"Gerry Hickman" <gerry666uk@yahoo.co.uk> wrote in message
news:ed$ysZeHFHA.2156@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> Try doing a search on "Using ADSI to Configure IIS", this is only one of
> many ways of doing it, but probably the one you're after.
>
> Beginner code might look a bit like this [shoddy example from the
> Microsoft docs]:
>
> ' Create an instance of the virtual directory object
> ' that represents the default Web site.
> Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")
>
> ' Use the Windows ADSI container object "Create" method to create
> ' a new virtual directory.
> Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir",
> "NewVDir")
>
> ' Use the Windows ADSI object "Put" method to
> ' set some required properties.
> IIsWebVDirObj.Put "Path", "C:\NewContent"
> IIsWebVDirObj.Put "AccessRead", True
> IIsWebVDirObj.Put "AccessScript", True
>
> ' Use the AppCreate2 method of the IIS ADSI provider to
> ' create an application on the new virtual directory.
> IIsWebVDirObj.AppCreate2 1
> IIsWebVDirObj.Put "AppFriendlyName", "NewApp"
>
> ' Use the Windows ADSI object "SetInfo" method to
> ' save the data to the metabase.
> IIsWebVDirObj.SetInfo
>
> Steven Frank wrote:
>
>
>
> --
> Gerry Hickman (London UK)
Post Follow-up to this messageOn Mon, 28 Feb 2005 15:26:01 -0600, "Steven Frank" <stevef@relation.com> wrote: >I am looking for a method to *programatically* add/remove Identities from a n >IIS 5 (Win2k) server. > >Manually, this is done via the Props window of the web site in question (vi a >the Advanced button in the Web Site Identification area of the Web Site >tab). Specifiy the IP Address, Port and Host Header and you're good to go. >I need to do this via script, shell or some other programable way. Take a look at the mkw3site.vbs script that installs if you install the scripts for IIS. I'm pretty sure you can set multiple IP, port and header names just by separating them by commas. Something like: makewebsite -i 192.168.1.10,192.168.1.20 -o 80,8080 -h www.sample.com,sample.com Jeff
Post Follow-up to this messageHi Steven, > Thanks, but I'm not trying to create a virtual directory. An "identity" > really has nothing to do with virtual directories. I know. I gave that code as an example. Did you do the search I suggested and read the ADSI docs? There are objects for dozens of IIS tasks. I don't know what an "identity" is in IIS, but are you saying you can't manipulate it with ADSI? -- Gerry Hickman (London UK)
Post Follow-up to this messageThanks, that looks to be pretty close, if not it. I'll have to play with it a little. I'm not sure if I can just add an Identity with it, but I may be able to tweak it if not. Thanks! "Jeff Cochran" <jeff.nospam@zina.com> wrote in message news:4228e3bf.1278244908@msnews.microsoft.com... > On Mon, 28 Feb 2005 15:26:01 -0600, "Steven Frank" > <stevef@relation.com> wrote: > > > Take a look at the mkw3site.vbs script that installs if you install > the scripts for IIS. I'm pretty sure you can set multiple IP, port > and header names just by separating them by commas. Something like: > > makewebsite -i 192.168.1.10,192.168.1.20 -o 80,8080 -h > www.sample.com,sample.com > > Jeff
Post Follow-up to this messageSteven Frank wrote: > Thanks, that looks to be pretty close, if not it. I'll have to play with it > a little. I'm not sure if I can just add an Identity with it, but I may b e > able to tweak it if not. The mk3site.vbs uses the exact same technology I indicated above. If the ready made scripts do what you need it's great, but personally I found them a bit limited. -- Gerry Hickman (London UK)
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.