I have a number of sites that all have an Admin hostname (subdomain) and all
point to the same directory; once they get there, the rest of the domain name
tells me who they are, etc.

I would like to simply add each new site to the existing serverbindings for
a collective AdministrativeScripts "web site". I cannot figure out how to
read the current serverbindings and then use that value to append the new
site and re-write the server bindings.

My amateur attempts so far have only yielded:
var xyz = c:\inetpub\adminscripts\adsutil.vbs get
w3svc\%siteidhere#\serverbindings

Is this possible? And is there a length limit to server bindings such that
this is a stupid way to go because once I add the xth binding it's going to
blow on me?

RLS
--
Randy L. Smith

RE: Adding ServerBindings by rls

rls
Wed Feb 01 00:10:27 CST 2006

I feel so close, but I can't get the serverbindings to display -- I can get
logfiledirectory and other things, but it says serverbindings are an array
and I just don't get it. Here's where I'm at with the script. It's called by
a batch file passing in the name of the web site and the script finds the key
by looking for that site. You see this outputs the log file directory just
fine, but it refuses to show me a server binding!:

var WebSiteName = WScript.Arguments(0);




var query = "SELECT Name, ServerComment, ServerBindings FROM
IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
var sites = providerObj.ExecQuery(query);
var theSiteKey=-1;

if (sites.Count != 0)
{
for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
{
var item = e.item();
var theSiteKey = item.Name.substr(6);
WScript.Echo("Key="+theSiteKey)
var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
var IIsWebServerObj = providerObj.get(fullstring);
cLogDir = IIsWebServerObj.LogFileDirectory;
WScript.Echo("LFD="+cLogDir);

cServerBinding = IIsWebServerObj.ServerBindings;
for(j = 0; j <= cServerBinding.length; j++)
{
var SBitem = cServerBinding[j];
WScript.Echo(SBitem);
}
}
}


--
Randy L. Smith


"RLS" wrote:

> I have a number of sites that all have an Admin hostname (subdomain) and all
> point to the same directory; once they get there, the rest of the domain name
> tells me who they are, etc.
>
> I would like to simply add each new site to the existing serverbindings for
> a collective AdministrativeScripts "web site". I cannot figure out how to
> read the current serverbindings and then use that value to append the new
> site and re-write the server bindings.
>
> My amateur attempts so far have only yielded:
> var xyz = c:\inetpub\adminscripts\adsutil.vbs get
> w3svc\%siteidhere#\serverbindings
>
> Is this possible? And is there a length limit to server bindings such that
> this is a stupid way to go because once I add the xth binding it's going to
> blow on me?
>
> RLS
> --
> Randy L. Smith

Re: Adding ServerBindings by David

David
Wed Feb 01 01:39:00 CST 2006

Here is a script tool that shows how to enumerate and display the
ServerBindings.
http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx


Here is a script tool that shows how to manipulate LIST properties like
ServerBindings and allows you to simply insert all your subdomains into the
same ServerBinding via one compact commandline syntax.
http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx


I don't think you need to write any VBScript/JScript yet...

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"RLS" <rls@mcpi.com> wrote in message
news:957010BC-867E-4346-B798-39547BD98DFD@microsoft.com...
>I feel so close, but I can't get the serverbindings to display -- I can get
> logfiledirectory and other things, but it says serverbindings are an array
> and I just don't get it. Here's where I'm at with the script. It's called
> by
> a batch file passing in the name of the web site and the script finds the
> key
> by looking for that site. You see this outputs the log file directory just
> fine, but it refuses to show me a server binding!:
>
> var WebSiteName = WScript.Arguments(0);
>
>
>
>
> var query = "SELECT Name, ServerComment, ServerBindings FROM
> IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
> var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
> var sites = providerObj.ExecQuery(query);
> var theSiteKey=-1;
>
> if (sites.Count != 0)
> {
> for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
> {
> var item = e.item();
> var theSiteKey = item.Name.substr(6);
> WScript.Echo("Key="+theSiteKey)
> var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
> var IIsWebServerObj = providerObj.get(fullstring);
> cLogDir = IIsWebServerObj.LogFileDirectory;
> WScript.Echo("LFD="+cLogDir);
>
> cServerBinding = IIsWebServerObj.ServerBindings;
> for(j = 0; j <= cServerBinding.length; j++)
> {
> var SBitem = cServerBinding[j];
> WScript.Echo(SBitem);
> }
> }
> }
>
>
> --
> Randy L. Smith
>
>
> "RLS" wrote:
>
>> I have a number of sites that all have an Admin hostname (subdomain) and
>> all
>> point to the same directory; once they get there, the rest of the domain
>> name
>> tells me who they are, etc.
>>
>> I would like to simply add each new site to the existing serverbindings
>> for
>> a collective AdministrativeScripts "web site". I cannot figure out how
>> to
>> read the current serverbindings and then use that value to append the new
>> site and re-write the server bindings.
>>
>> My amateur attempts so far have only yielded:
>> var xyz = c:\inetpub\adminscripts\adsutil.vbs get
>> w3svc\%siteidhere#\serverbindings
>>
>> Is this possible? And is there a length limit to server bindings such
>> that
>> this is a stupid way to go because once I add the xth binding it's going
>> to
>> blow on me?
>>
>> RLS
>> --
>> Randy L. Smith



Re: Adding ServerBindings by rls

rls
Wed Feb 01 02:28:28 CST 2006

David,
This is one of those instances where if we were standing next to each other,
I'd have to say I see your lips moving and you're speaking, but it's a
completely foreign language! Perhaps the problem now lies in the fact that
I"ve been coding steadily for 19 hours for the third day in a row and
probably just need more sleep (but I've got to get this server migrated!!!!!).

However, you said that one of those shows me how to simply use a command
line function to insert a subdomain. Through red bleary eyes I have to ask
you to hold my hand on this one: just which / what function are you talking
about? I just don't see.

Oy vey. Time to head home I think. Thanks for all your help!
--
Randy L. Smith


"David Wang [Msft]" wrote:

> Here is a script tool that shows how to enumerate and display the
> ServerBindings.
> http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx
>
>
> Here is a script tool that shows how to manipulate LIST properties like
> ServerBindings and allows you to simply insert all your subdomains into the
> same ServerBinding via one compact commandline syntax.
> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
>
>
> I don't think you need to write any VBScript/JScript yet...
>
> --
> //David
> IIS
> http://blogs.msdn.com/David.Wang
> This posting is provided "AS IS" with no warranties, and confers no rights.
> //
>
> "RLS" <rls@mcpi.com> wrote in message
> news:957010BC-867E-4346-B798-39547BD98DFD@microsoft.com...
> >I feel so close, but I can't get the serverbindings to display -- I can get
> > logfiledirectory and other things, but it says serverbindings are an array
> > and I just don't get it. Here's where I'm at with the script. It's called
> > by
> > a batch file passing in the name of the web site and the script finds the
> > key
> > by looking for that site. You see this outputs the log file directory just
> > fine, but it refuses to show me a server binding!:
> >
> > var WebSiteName = WScript.Arguments(0);
> >
> >
> >
> >
> > var query = "SELECT Name, ServerComment, ServerBindings FROM
> > IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
> > var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
> > var sites = providerObj.ExecQuery(query);
> > var theSiteKey=-1;
> >
> > if (sites.Count != 0)
> > {
> > for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
> > {
> > var item = e.item();
> > var theSiteKey = item.Name.substr(6);
> > WScript.Echo("Key="+theSiteKey)
> > var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
> > var IIsWebServerObj = providerObj.get(fullstring);
> > cLogDir = IIsWebServerObj.LogFileDirectory;
> > WScript.Echo("LFD="+cLogDir);
> >
> > cServerBinding = IIsWebServerObj.ServerBindings;
> > for(j = 0; j <= cServerBinding.length; j++)
> > {
> > var SBitem = cServerBinding[j];
> > WScript.Echo(SBitem);
> > }
> > }
> > }
> >
> >
> > --
> > Randy L. Smith
> >
> >
> > "RLS" wrote:
> >
> >> I have a number of sites that all have an Admin hostname (subdomain) and
> >> all
> >> point to the same directory; once they get there, the rest of the domain
> >> name
> >> tells me who they are, etc.
> >>
> >> I would like to simply add each new site to the existing serverbindings
> >> for
> >> a collective AdministrativeScripts "web site". I cannot figure out how
> >> to
> >> read the current serverbindings and then use that value to append the new
> >> site and re-write the server bindings.
> >>
> >> My amateur attempts so far have only yielded:
> >> var xyz = c:\inetpub\adminscripts\adsutil.vbs get
> >> w3svc\%siteidhere#\serverbindings
> >>
> >> Is this possible? And is there a length limit to server bindings such
> >> that
> >> this is a stupid way to go because once I add the xth binding it's going
> >> to
> >> blow on me?
> >>
> >> RLS
> >> --
> >> Randy L. Smith
>
>
>

Re: Adding ServerBindings by David

David
Wed Feb 01 03:32:39 CST 2006

My referenced blog entries contain source code to real working scripts.

Save the script code from the following blog entry into a file (I named mine
ChgList.vbs):
http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx

Then execute the following on the command shell:

chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com /insert
chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com /insert


Add /commit to the chglist.vbs command to have the action actually take
effect (it defaults to just showing what happens)

chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com /insert
/commit
chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com /insert
/commit



What this syntax basically means is - find the first element of the list and
insert :80:subdomain1.domain.com in front of it.

The tool also supports FIRST, LAST, and "substring match" where you give a
unique identifying string that matches the list item which you want to then
insert in front of, replace with, or remove

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"RLS" <rls@mcpi.com> wrote in message
news:3737DA55-345F-4078-9055-9626B3D1A715@microsoft.com...
> David,
> This is one of those instances where if we were standing next to each
> other,
> I'd have to say I see your lips moving and you're speaking, but it's a
> completely foreign language! Perhaps the problem now lies in the fact
> that
> I"ve been coding steadily for 19 hours for the third day in a row and
> probably just need more sleep (but I've got to get this server
> migrated!!!!!).
>
> However, you said that one of those shows me how to simply use a command
> line function to insert a subdomain. Through red bleary eyes I have to
> ask
> you to hold my hand on this one: just which / what function are you
> talking
> about? I just don't see.
>
> Oy vey. Time to head home I think. Thanks for all your help!
> --
> Randy L. Smith
>
>
> "David Wang [Msft]" wrote:
>
>> Here is a script tool that shows how to enumerate and display the
>> ServerBindings.
>> http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx
>>
>>
>> Here is a script tool that shows how to manipulate LIST properties like
>> ServerBindings and allows you to simply insert all your subdomains into
>> the
>> same ServerBinding via one compact commandline syntax.
>> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
>>
>>
>> I don't think you need to write any VBScript/JScript yet...
>>
>> --
>> //David
>> IIS
>> http://blogs.msdn.com/David.Wang
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> //
>>
>> "RLS" <rls@mcpi.com> wrote in message
>> news:957010BC-867E-4346-B798-39547BD98DFD@microsoft.com...
>> >I feel so close, but I can't get the serverbindings to display -- I can
>> >get
>> > logfiledirectory and other things, but it says serverbindings are an
>> > array
>> > and I just don't get it. Here's where I'm at with the script. It's
>> > called
>> > by
>> > a batch file passing in the name of the web site and the script finds
>> > the
>> > key
>> > by looking for that site. You see this outputs the log file directory
>> > just
>> > fine, but it refuses to show me a server binding!:
>> >
>> > var WebSiteName = WScript.Arguments(0);
>> >
>> >
>> >
>> >
>> > var query = "SELECT Name, ServerComment, ServerBindings FROM
>> > IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
>> > var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
>> > var sites = providerObj.ExecQuery(query);
>> > var theSiteKey=-1;
>> >
>> > if (sites.Count != 0)
>> > {
>> > for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
>> > {
>> > var item = e.item();
>> > var theSiteKey = item.Name.substr(6);
>> > WScript.Echo("Key="+theSiteKey)
>> > var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
>> > var IIsWebServerObj = providerObj.get(fullstring);
>> > cLogDir = IIsWebServerObj.LogFileDirectory;
>> > WScript.Echo("LFD="+cLogDir);
>> >
>> > cServerBinding = IIsWebServerObj.ServerBindings;
>> > for(j = 0; j <= cServerBinding.length; j++)
>> > {
>> > var SBitem = cServerBinding[j];
>> > WScript.Echo(SBitem);
>> > }
>> > }
>> > }
>> >
>> >
>> > --
>> > Randy L. Smith
>> >
>> >
>> > "RLS" wrote:
>> >
>> >> I have a number of sites that all have an Admin hostname (subdomain)
>> >> and
>> >> all
>> >> point to the same directory; once they get there, the rest of the
>> >> domain
>> >> name
>> >> tells me who they are, etc.
>> >>
>> >> I would like to simply add each new site to the existing
>> >> serverbindings
>> >> for
>> >> a collective AdministrativeScripts "web site". I cannot figure out
>> >> how
>> >> to
>> >> read the current serverbindings and then use that value to append the
>> >> new
>> >> site and re-write the server bindings.
>> >>
>> >> My amateur attempts so far have only yielded:
>> >> var xyz = c:\inetpub\adminscripts\adsutil.vbs get
>> >> w3svc\%siteidhere#\serverbindings
>> >>
>> >> Is this possible? And is there a length limit to server bindings such
>> >> that
>> >> this is a stupid way to go because once I add the xth binding it's
>> >> going
>> >> to
>> >> blow on me?
>> >>
>> >> RLS
>> >> --
>> >> Randy L. Smith
>>
>>
>>



Re: Adding ServerBindings by rls

rls
Wed Feb 01 13:55:39 CST 2006

Thank you so very very much! And you've probably helped legions of
programmers after me with this posting!

Where can I put in my nomination for you for Employee of the Year? :-)
--
Randy L. Smith


"David Wang [Msft]" wrote:

> My referenced blog entries contain source code to real working scripts.
>
> Save the script code from the following blog entry into a file (I named mine
> ChgList.vbs):
> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
>
> Then execute the following on the command shell:
>
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com /insert
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com /insert
>
>
> Add /commit to the chglist.vbs command to have the action actually take
> effect (it defaults to just showing what happens)
>
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com /insert
> /commit
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com /insert
> /commit
>
>
>
> What this syntax basically means is - find the first element of the list and
> insert :80:subdomain1.domain.com in front of it.
>
> The tool also supports FIRST, LAST, and "substring match" where you give a
> unique identifying string that matches the list item which you want to then
> insert in front of, replace with, or remove
>
> --
> //David
> IIS
> http://blogs.msdn.com/David.Wang
> This posting is provided "AS IS" with no warranties, and confers no rights.
> //
>
> "RLS" <rls@mcpi.com> wrote in message
> news:3737DA55-345F-4078-9055-9626B3D1A715@microsoft.com...
> > David,
> > This is one of those instances where if we were standing next to each
> > other,
> > I'd have to say I see your lips moving and you're speaking, but it's a
> > completely foreign language! Perhaps the problem now lies in the fact
> > that
> > I"ve been coding steadily for 19 hours for the third day in a row and
> > probably just need more sleep (but I've got to get this server
> > migrated!!!!!).
> >
> > However, you said that one of those shows me how to simply use a command
> > line function to insert a subdomain. Through red bleary eyes I have to
> > ask
> > you to hold my hand on this one: just which / what function are you
> > talking
> > about? I just don't see.
> >
> > Oy vey. Time to head home I think. Thanks for all your help!
> > --
> > Randy L. Smith
> >
> >
> > "David Wang [Msft]" wrote:
> >
> >> Here is a script tool that shows how to enumerate and display the
> >> ServerBindings.
> >> http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx
> >>
> >>
> >> Here is a script tool that shows how to manipulate LIST properties like
> >> ServerBindings and allows you to simply insert all your subdomains into
> >> the
> >> same ServerBinding via one compact commandline syntax.
> >> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
> >>
> >>
> >> I don't think you need to write any VBScript/JScript yet...
> >>
> >> --
> >> //David
> >> IIS
> >> http://blogs.msdn.com/David.Wang
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >> //
> >>
> >> "RLS" <rls@mcpi.com> wrote in message
> >> news:957010BC-867E-4346-B798-39547BD98DFD@microsoft.com...
> >> >I feel so close, but I can't get the serverbindings to display -- I can
> >> >get
> >> > logfiledirectory and other things, but it says serverbindings are an
> >> > array
> >> > and I just don't get it. Here's where I'm at with the script. It's
> >> > called
> >> > by
> >> > a batch file passing in the name of the web site and the script finds
> >> > the
> >> > key
> >> > by looking for that site. You see this outputs the log file directory
> >> > just
> >> > fine, but it refuses to show me a server binding!:
> >> >
> >> > var WebSiteName = WScript.Arguments(0);
> >> >
> >> >
> >> >
> >> >
> >> > var query = "SELECT Name, ServerComment, ServerBindings FROM
> >> > IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
> >> > var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
> >> > var sites = providerObj.ExecQuery(query);
> >> > var theSiteKey=-1;
> >> >
> >> > if (sites.Count != 0)
> >> > {
> >> > for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
> >> > {
> >> > var item = e.item();
> >> > var theSiteKey = item.Name.substr(6);
> >> > WScript.Echo("Key="+theSiteKey)
> >> > var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
> >> > var IIsWebServerObj = providerObj.get(fullstring);
> >> > cLogDir = IIsWebServerObj.LogFileDirectory;
> >> > WScript.Echo("LFD="+cLogDir);
> >> >
> >> > cServerBinding = IIsWebServerObj.ServerBindings;
> >> > for(j = 0; j <= cServerBinding.length; j++)
> >> > {
> >> > var SBitem = cServerBinding[j];
> >> > WScript.Echo(SBitem);
> >> > }
> >> > }
> >> > }
> >> >
> >> >
> >> > --
> >> > Randy L. Smith
> >> >
> >> >
> >> > "RLS" wrote:
> >> >
> >> >> I have a number of sites that all have an Admin hostname (subdomain)
> >> >> and
> >> >> all
> >> >> point to the same directory; once they get there, the rest of the
> >> >> domain
> >> >> name
> >> >> tells me who they are, etc.
> >> >>
> >> >> I would like to simply add each new site to the existing
> >> >> serverbindings
> >> >> for
> >> >> a collective AdministrativeScripts "web site". I cannot figure out
> >> >> how
> >> >> to
> >> >> read the current serverbindings and then use that value to append the
> >> >> new
> >> >> site and re-write the server bindings.
> >> >>
> >> >> My amateur attempts so far have only yielded:
> >> >> var xyz = c:\inetpub\adminscripts\adsutil.vbs get
> >> >> w3svc\%siteidhere#\serverbindings
> >> >>
> >> >> Is this possible? And is there a length limit to server bindings such
> >> >> that
> >> >> this is a stupid way to go because once I add the xth binding it's
> >> >> going
> >> >> to
> >> >> blow on me?
> >> >>
> >> >> RLS
> >> >> --
> >> >> Randy L. Smith
> >>
> >>
> >>
>
>
>

Re: Adding ServerBindings by rls

rls
Wed Feb 01 14:05:29 CST 2006

Oh - one more thing (non critical, I think): do you know if there is a limit
to how many server bindings one can have on one site?

For the project that I am on, I can easily see 500 or 1000 sites or more
referenced from one web site definition and it's associated serverBinding.

You've given me the fever to learn VBS and do more script writing. Guess I
should start with a scripts class, ay? Thanks again! RLS
--
Randy L. Smith


"David Wang [Msft]" wrote:

> My referenced blog entries contain source code to real working scripts.
>
> Save the script code from the following blog entry into a file (I named mine
> ChgList.vbs):
> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
>
> Then execute the following on the command shell:
>
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com /insert
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com /insert
>
>
> Add /commit to the chglist.vbs command to have the action actually take
> effect (it defaults to just showing what happens)
>
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com /insert
> /commit
> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com /insert
> /commit
>
>
>
> What this syntax basically means is - find the first element of the list and
> insert :80:subdomain1.domain.com in front of it.
>
> The tool also supports FIRST, LAST, and "substring match" where you give a
> unique identifying string that matches the list item which you want to then
> insert in front of, replace with, or remove
>
> --
> //David
> IIS
> http://blogs.msdn.com/David.Wang
> This posting is provided "AS IS" with no warranties, and confers no rights.
> //
>
> "RLS" <rls@mcpi.com> wrote in message
> news:3737DA55-345F-4078-9055-9626B3D1A715@microsoft.com...
> > David,
> > This is one of those instances where if we were standing next to each
> > other,
> > I'd have to say I see your lips moving and you're speaking, but it's a
> > completely foreign language! Perhaps the problem now lies in the fact
> > that
> > I"ve been coding steadily for 19 hours for the third day in a row and
> > probably just need more sleep (but I've got to get this server
> > migrated!!!!!).
> >
> > However, you said that one of those shows me how to simply use a command
> > line function to insert a subdomain. Through red bleary eyes I have to
> > ask
> > you to hold my hand on this one: just which / what function are you
> > talking
> > about? I just don't see.
> >
> > Oy vey. Time to head home I think. Thanks for all your help!
> > --
> > Randy L. Smith
> >
> >
> > "David Wang [Msft]" wrote:
> >
> >> Here is a script tool that shows how to enumerate and display the
> >> ServerBindings.
> >> http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx
> >>
> >>
> >> Here is a script tool that shows how to manipulate LIST properties like
> >> ServerBindings and allows you to simply insert all your subdomains into
> >> the
> >> same ServerBinding via one compact commandline syntax.
> >> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
> >>
> >>
> >> I don't think you need to write any VBScript/JScript yet...
> >>
> >> --
> >> //David
> >> IIS
> >> http://blogs.msdn.com/David.Wang
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >> //
> >>
> >> "RLS" <rls@mcpi.com> wrote in message
> >> news:957010BC-867E-4346-B798-39547BD98DFD@microsoft.com...
> >> >I feel so close, but I can't get the serverbindings to display -- I can
> >> >get
> >> > logfiledirectory and other things, but it says serverbindings are an
> >> > array
> >> > and I just don't get it. Here's where I'm at with the script. It's
> >> > called
> >> > by
> >> > a batch file passing in the name of the web site and the script finds
> >> > the
> >> > key
> >> > by looking for that site. You see this outputs the log file directory
> >> > just
> >> > fine, but it refuses to show me a server binding!:
> >> >
> >> > var WebSiteName = WScript.Arguments(0);
> >> >
> >> >
> >> >
> >> >
> >> > var query = "SELECT Name, ServerComment, ServerBindings FROM
> >> > IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
> >> > var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
> >> > var sites = providerObj.ExecQuery(query);
> >> > var theSiteKey=-1;
> >> >
> >> > if (sites.Count != 0)
> >> > {
> >> > for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
> >> > {
> >> > var item = e.item();
> >> > var theSiteKey = item.Name.substr(6);
> >> > WScript.Echo("Key="+theSiteKey)
> >> > var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
> >> > var IIsWebServerObj = providerObj.get(fullstring);
> >> > cLogDir = IIsWebServerObj.LogFileDirectory;
> >> > WScript.Echo("LFD="+cLogDir);
> >> >
> >> > cServerBinding = IIsWebServerObj.ServerBindings;
> >> > for(j = 0; j <= cServerBinding.length; j++)
> >> > {
> >> > var SBitem = cServerBinding[j];
> >> > WScript.Echo(SBitem);
> >> > }
> >> > }
> >> > }
> >> >
> >> >
> >> > --
> >> > Randy L. Smith
> >> >
> >> >
> >> > "RLS" wrote:
> >> >
> >> >> I have a number of sites that all have an Admin hostname (subdomain)
> >> >> and
> >> >> all
> >> >> point to the same directory; once they get there, the rest of the
> >> >> domain
> >> >> name
> >> >> tells me who they are, etc.
> >> >>
> >> >> I would like to simply add each new site to the existing
> >> >> serverbindings
> >> >> for
> >> >> a collective AdministrativeScripts "web site". I cannot figure out
> >> >> how
> >> >> to
> >> >> read the current serverbindings and then use that value to append the
> >> >> new
> >> >> site and re-write the server bindings.
> >> >>
> >> >> My amateur attempts so far have only yielded:
> >> >> var xyz = c:\inetpub\adminscripts\adsutil.vbs get
> >> >> w3svc\%siteidhere#\serverbindings
> >> >>
> >> >> Is this possible? And is there a length limit to server bindings such
> >> >> that
> >> >> this is a stupid way to go because once I add the xth binding it's
> >> >> going
> >> >> to
> >> >> blow on me?
> >> >>
> >> >> RLS
> >> >> --
> >> >> Randy L. Smith
> >>
> >>
> >>
>
>
>

Re: Adding ServerBindings by David

David
Wed Feb 01 21:26:54 CST 2006

I'm not aware of a limit for ServerBinding other than available memory. If
you do run into a limit that seems "low" we can look at it.

We've easily configured up to 100,000 website ServerBindings before... The
websites weren't all running at once (memory constraints), but the bindings
stored in HTTP.SYS ok, which is the important thing.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"RLS" <rls@mcpi.com> wrote in message
news:37DA7AA3-B373-468E-83D3-4D9B1714D323@microsoft.com...
> Oh - one more thing (non critical, I think): do you know if there is a
> limit
> to how many server bindings one can have on one site?
>
> For the project that I am on, I can easily see 500 or 1000 sites or more
> referenced from one web site definition and it's associated serverBinding.
>
> You've given me the fever to learn VBS and do more script writing. Guess I
> should start with a scripts class, ay? Thanks again! RLS
> --
> Randy L. Smith
>
>
> "David Wang [Msft]" wrote:
>
>> My referenced blog entries contain source code to real working scripts.
>>
>> Save the script code from the following blog entry into a file (I named
>> mine
>> ChgList.vbs):
>> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
>>
>> Then execute the following on the command shell:
>>
>> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com
>> /insert
>> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com
>> /insert
>>
>>
>> Add /commit to the chglist.vbs command to have the action actually take
>> effect (it defaults to just showing what happens)
>>
>> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain1.domain.com
>> /insert
>> /commit
>> chglist.vbs w3svc/1/serverbindings FIRST :80:subdomain2.domain.com
>> /insert
>> /commit
>>
>>
>>
>> What this syntax basically means is - find the first element of the list
>> and
>> insert :80:subdomain1.domain.com in front of it.
>>
>> The tool also supports FIRST, LAST, and "substring match" where you give
>> a
>> unique identifying string that matches the list item which you want to
>> then
>> insert in front of, replace with, or remove
>>
>> --
>> //David
>> IIS
>> http://blogs.msdn.com/David.Wang
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> //
>>
>> "RLS" <rls@mcpi.com> wrote in message
>> news:3737DA55-345F-4078-9055-9626B3D1A715@microsoft.com...
>> > David,
>> > This is one of those instances where if we were standing next to each
>> > other,
>> > I'd have to say I see your lips moving and you're speaking, but it's a
>> > completely foreign language! Perhaps the problem now lies in the fact
>> > that
>> > I"ve been coding steadily for 19 hours for the third day in a row and
>> > probably just need more sleep (but I've got to get this server
>> > migrated!!!!!).
>> >
>> > However, you said that one of those shows me how to simply use a
>> > command
>> > line function to insert a subdomain. Through red bleary eyes I have to
>> > ask
>> > you to hold my hand on this one: just which / what function are you
>> > talking
>> > about? I just don't see.
>> >
>> > Oy vey. Time to head home I think. Thanks for all your help!
>> > --
>> > Randy L. Smith
>> >
>> >
>> > "David Wang [Msft]" wrote:
>> >
>> >> Here is a script tool that shows how to enumerate and display the
>> >> ServerBindings.
>> >> http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx
>> >>
>> >>
>> >> Here is a script tool that shows how to manipulate LIST properties
>> >> like
>> >> ServerBindings and allows you to simply insert all your subdomains
>> >> into
>> >> the
>> >> same ServerBinding via one compact commandline syntax.
>> >> http://blogs.msdn.com/david.wang/archive/2004/12/02/273681.aspx
>> >>
>> >>
>> >> I don't think you need to write any VBScript/JScript yet...
>> >>
>> >> --
>> >> //David
>> >> IIS
>> >> http://blogs.msdn.com/David.Wang
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >> //
>> >>
>> >> "RLS" <rls@mcpi.com> wrote in message
>> >> news:957010BC-867E-4346-B798-39547BD98DFD@microsoft.com...
>> >> >I feel so close, but I can't get the serverbindings to display -- I
>> >> >can
>> >> >get
>> >> > logfiledirectory and other things, but it says serverbindings are an
>> >> > array
>> >> > and I just don't get it. Here's where I'm at with the script. It's
>> >> > called
>> >> > by
>> >> > a batch file passing in the name of the web site and the script
>> >> > finds
>> >> > the
>> >> > key
>> >> > by looking for that site. You see this outputs the log file
>> >> > directory
>> >> > just
>> >> > fine, but it refuses to show me a server binding!:
>> >> >
>> >> > var WebSiteName = WScript.Arguments(0);
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > var query = "SELECT Name, ServerComment, ServerBindings FROM
>> >> > IIsWebServerSetting WHERE ServerComment='" + WebSiteName + "'";
>> >> > var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
>> >> > var sites = providerObj.ExecQuery(query);
>> >> > var theSiteKey=-1;
>> >> >
>> >> > if (sites.Count != 0)
>> >> > {
>> >> > for(e = new Enumerator(sites); ! e.atEnd(); e.moveNext())
>> >> > {
>> >> > var item = e.item();
>> >> > var theSiteKey = item.Name.substr(6);
>> >> > WScript.Echo("Key="+theSiteKey)
>> >> > var fullstring= "IIsWebServerSetting='W3SVC/"+theSiteKey+"'";
>> >> > var IIsWebServerObj = providerObj.get(fullstring);
>> >> > cLogDir = IIsWebServerObj.LogFileDirectory;
>> >> > WScript.Echo("LFD="+cLogDir);
>> >> >
>> >> > cServerBinding = IIsWebServerObj.ServerBindings;
>> >> > for(j = 0; j <= cServerBinding.length; j++)
>> >> > {
>> >>