Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

IIS Multiple Identities
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



Report this thread to moderator Post Follow-up to this message
Old Post
Steven Frank
03-01-05 01:55 AM


Re: IIS Multiple Identities
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:

> 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)

Report this thread to moderator Post Follow-up to this message
Old Post
Gerry Hickman
03-01-05 01:55 AM


Re: IIS Multiple Identities
Thanks, 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)



Report this thread to moderator Post Follow-up to this message
Old Post
Steven Frank
03-01-05 08:55 PM


Re: IIS Multiple Identities
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
Jeff Cochran
03-02-05 01:55 AM


Re: IIS Multiple Identities
Hi 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)

Report this thread to moderator Post Follow-up to this message
Old Post
Gerry Hickman
03-02-05 01:55 AM


Re: IIS Multiple Identities
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 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



Report this thread to moderator Post Follow-up to this message
Old Post
Steven Frank
03-02-05 08:55 AM


Re: IIS Multiple Identities
Steven 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)

Report this thread to moderator Post Follow-up to this message
Old Post
Gerry Hickman
03-03-05 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

WSH archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:45 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.