Configure IIS using VBScript?
Configure IIS using VBScript?
am 05.11.2007 12:49:02 von bds
Hey All,
I have a task that is proving difficult to master. I have over 200 IIS
servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows 2003).
On each server, for each site, I need to:
1) Disable directory browsing if it is enabled
2) Set logging format WC3 format if it isn't already
3) List all the virtual directories per site and delete if it matches known
directories that aren't permitted
4) Set "Enable Parent Paths" to disabled
I also need to do this on the server level as well, to ensure new sites are
not created with the wrong values.
Any examples on doing this type of stuff apreciated!
TIA,
Brad
Re: Configure IIS using VBScript?
am 05.11.2007 19:03:50 von Kristofer Gafvert
Hi,
Have you seen the IIS script center? It has many useful examples:
http://www.microsoft.com/technet/scriptcenter/scripts/iis/de fault.mspx?mfr=true
Do note however that the scripts for IIS 6 uses WMI, which cannot be used
for IIS 5. You can however use ADSI for both IIS versions.
Below i give you the metabase properties you want to change
1) DirBrowseFlags
http://msdn2.microsoft.com/en-us/library/ms524576.aspx
2) LogPluginClsid, also check LogType
http://msdn2.microsoft.com/en-us/library/ms524325.aspx
http://msdn2.microsoft.com/en-us/library/ms525274.aspx
http://msdn2.microsoft.com/en-us/library/ms524877.aspx
3) Enumerate the virtual directories and check each one.
ADSI: http://www.iisfaq.com/Default.aspx?tabid=2745
WMI: http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
4) AspEnableParentPaths
http://msdn2.microsoft.com/en-us/library/ms524697.aspx
How much help do you need (what level are you on)? With the above
information, can you put together something?
If you want to set it on the server level, you basically set the metabase
property on the /LM/W3SVC node to the correct value.
As always, when changing the metabase, i recommend you to back it up before.
Hope this helps!
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
Brad wrote:
>Hey All,
>
>I have a task that is proving difficult to master. I have over 200 IIS
>servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
>2003).
>On each server, for each site, I need to:
>
>1) Disable directory browsing if it is enabled
>2) Set logging format WC3 format if it isn't already
>3) List all the virtual directories per site and delete if it matches known
>directories that aren't permitted
>4) Set "Enable Parent Paths" to disabled
>
>I also need to do this on the server level as well, to ensure new sites are
>not created with the wrong values.
>
>Any examples on doing this type of stuff apreciated!
>
>TIA,
>Brad
Re: Configure IIS using VBScript?
am 06.11.2007 11:50:00 von bds
Kristofer,
Thanks for all that, I will digest it now and see how I go but it seem that
you have covered most things (even the annoying bit about no WMI on IIS 5.0)
Thanks again.
"Kristofer Gafvert" wrote:
> Hi,
>
> Have you seen the IIS script center? It has many useful examples:
>
> http://www.microsoft.com/technet/scriptcenter/scripts/iis/de fault.mspx?mfr=true
>
> Do note however that the scripts for IIS 6 uses WMI, which cannot be used
> for IIS 5. You can however use ADSI for both IIS versions.
>
> Below i give you the metabase properties you want to change
>
> 1) DirBrowseFlags
> http://msdn2.microsoft.com/en-us/library/ms524576.aspx
>
> 2) LogPluginClsid, also check LogType
> http://msdn2.microsoft.com/en-us/library/ms524325.aspx
> http://msdn2.microsoft.com/en-us/library/ms525274.aspx
> http://msdn2.microsoft.com/en-us/library/ms524877.aspx
>
> 3) Enumerate the virtual directories and check each one.
> ADSI: http://www.iisfaq.com/Default.aspx?tabid=2745
> WMI: http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
>
> 4) AspEnableParentPaths
> http://msdn2.microsoft.com/en-us/library/ms524697.aspx
>
>
> How much help do you need (what level are you on)? With the above
> information, can you put together something?
>
> If you want to set it on the server level, you basically set the metabase
> property on the /LM/W3SVC node to the correct value.
>
> As always, when changing the metabase, i recommend you to back it up before.
>
> Hope this helps!
>
> --
> Regards,
> Kristofer Gafvert
> http://www.gafvert.info/iis/ - IIS Related Info
>
>
> Brad wrote:
>
> >Hey All,
> >
> >I have a task that is proving difficult to master. I have over 200 IIS
> >servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
> >2003).
> >On each server, for each site, I need to:
> >
> >1) Disable directory browsing if it is enabled
> >2) Set logging format WC3 format if it isn't already
> >3) List all the virtual directories per site and delete if it matches known
> >directories that aren't permitted
> >4) Set "Enable Parent Paths" to disabled
> >
> >I also need to do this on the server level as well, to ensure new sites are
> >not created with the wrong values.
> >
> >Any examples on doing this type of stuff apreciated!
> >
> >TIA,
> >Brad
>
Re: Configure IIS using VBScript?
am 06.11.2007 18:16:01 von bds
Thanks to the stuff you gave me, mainly the IISFAQ.COM stuff I have now got
this to report each setting. I will work on getting it to change settings
tomorrow and update accordingly.
A couple fo questions though, how does the "Level" variable work? I don't
seem to be able to find much doco on it. I understand what it represents,
and that incrementing it means you move 1 Level further down the tree, but
couldn't find it listed in MetaBase Explorer for example. I also would have
thought there should be some sort of counter to stop the script trying to
recurse past the last level. Looking at it as it stands it calls itself
forever although the script actually behaves the way you would want it too
and doesn't error.
Also, I gather that I can configure the required values according to the
matrix below?
Server Site Virtual Folder Physical Folder
Directory Browsing YES YES YES YES
ASP Enable Paths YES YES YES YES
Log Format YES YES NO NO
Does that look about right?
Again, thanks a lot for youe help.
Brad
"Brad" wrote:
> Kristofer,
>
> Thanks for all that, I will digest it now and see how I go but it seem that
> you have covered most things (even the annoying bit about no WMI on IIS 5.0)
>
> Thanks again.
>
> "Kristofer Gafvert" wrote:
>
> > Hi,
> >
> > Have you seen the IIS script center? It has many useful examples:
> >
> > http://www.microsoft.com/technet/scriptcenter/scripts/iis/de fault.mspx?mfr=true
> >
> > Do note however that the scripts for IIS 6 uses WMI, which cannot be used
> > for IIS 5. You can however use ADSI for both IIS versions.
> >
> > Below i give you the metabase properties you want to change
> >
> > 1) DirBrowseFlags
> > http://msdn2.microsoft.com/en-us/library/ms524576.aspx
> >
> > 2) LogPluginClsid, also check LogType
> > http://msdn2.microsoft.com/en-us/library/ms524325.aspx
> > http://msdn2.microsoft.com/en-us/library/ms525274.aspx
> > http://msdn2.microsoft.com/en-us/library/ms524877.aspx
> >
> > 3) Enumerate the virtual directories and check each one.
> > ADSI: http://www.iisfaq.com/Default.aspx?tabid=2745
> > WMI: http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
> >
> > 4) AspEnableParentPaths
> > http://msdn2.microsoft.com/en-us/library/ms524697.aspx
> >
> >
> > How much help do you need (what level are you on)? With the above
> > information, can you put together something?
> >
> > If you want to set it on the server level, you basically set the metabase
> > property on the /LM/W3SVC node to the correct value.
> >
> > As always, when changing the metabase, i recommend you to back it up before.
> >
> > Hope this helps!
> >
> > --
> > Regards,
> > Kristofer Gafvert
> > http://www.gafvert.info/iis/ - IIS Related Info
> >
> >
> > Brad wrote:
> >
> > >Hey All,
> > >
> > >I have a task that is proving difficult to master. I have over 200 IIS
> > >servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
> > >2003).
> > >On each server, for each site, I need to:
> > >
> > >1) Disable directory browsing if it is enabled
> > >2) Set logging format WC3 format if it isn't already
> > >3) List all the virtual directories per site and delete if it matches known
> > >directories that aren't permitted
> > >4) Set "Enable Parent Paths" to disabled
> > >
> > >I also need to do this on the server level as well, to ensure new sites are
> > >not created with the wrong values.
> > >
> > >Any examples on doing this type of stuff apreciated!
> > >
> > >TIA,
> > >Brad
> >
Re: Configure IIS using VBScript?
am 08.11.2007 07:05:33 von Kristofer Gafvert
Hi,
Sorry for my late reply, i have had many other things to do.
"level" is not part of the metabase. It is only a variable used in the
script.
The scripts runs until it cannot find any more IIsWebVirtualDir (or
IIsWebDirectory). It is the For Each clause doing this.
The matrix is correct. But...a physical folder is not automatically a
IIsWebDirectory. By default, it is not part of the metabase at all which
means you cannot enumerate the metabase to check the name of a physical
folder (unless you know that each folder is a IIsWebDirectory). You need
to check the file system.
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
Brad wrote:
>Thanks to the stuff you gave me, mainly the IISFAQ.COM stuff I have now got
>this to report each setting. I will work on getting it to change settings
>tomorrow and update accordingly.
>
>A couple fo questions though, how does the "Level" variable work? I don't
>seem to be able to find much doco on it. I understand what it represents,
>and that incrementing it means you move 1 Level further down the tree, but
>couldn't find it listed in MetaBase Explorer for example. I also would have
>thought there should be some sort of counter to stop the script trying to
>recurse past the last level. Looking at it as it stands it calls itself
>forever although the script actually behaves the way you would want it too
>and doesn't error.
>
>Also, I gather that I can configure the required values according to the
>matrix below?
>
> Server Site Virtual Folder Physical Folder
>Directory Browsing YES YES YES YES
>ASP Enable Paths YES YES YES YES
>Log Format YES YES NO NO
>
>Does that look about right?
>
>Again, thanks a lot for youe help.
>Brad
>
>"Brad" wrote:
>
>>Kristofer,
>>
>>Thanks for all that, I will digest it now and see how I go but it seem
>>that
>>you have covered most things (even the annoying bit about no WMI on IIS
>>5.0)
>>
>>Thanks again.
>>
>>"Kristofer Gafvert" wrote:
>>
>>>Hi,
>>>
>>>Have you seen the IIS script center? It has many useful examples:
>>>
>>>http://www.microsoft.com/technet/scriptcenter/scripts/iis /default.mspx?mfr=true
>>>
>>>Do note however that the scripts for IIS 6 uses WMI, which cannot be used
>>>for IIS 5. You can however use ADSI for both IIS versions.
>>>
>>>Below i give you the metabase properties you want to change
>>>
>>>1) DirBrowseFlags
>>>http://msdn2.microsoft.com/en-us/library/ms524576.aspx
>>>
>>>2) LogPluginClsid, also check LogType
>>>http://msdn2.microsoft.com/en-us/library/ms524325.aspx
>>>http://msdn2.microsoft.com/en-us/library/ms525274.aspx
>>>http://msdn2.microsoft.com/en-us/library/ms524877.aspx
>>>
>>>3) Enumerate the virtual directories and check each one.
>>>ADSI: http://www.iisfaq.com/Default.aspx?tabid=2745
>>>WMI: http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
>>>
>>>4) AspEnableParentPaths
>>>http://msdn2.microsoft.com/en-us/library/ms524697.aspx
>>>
>>>
>>>How much help do you need (what level are you on)? With the above
>>>information, can you put together something?
>>>
>>>If you want to set it on the server level, you basically set the metabase
>>>property on the /LM/W3SVC node to the correct value.
>>>
>>>As always, when changing the metabase, i recommend you to back it up
>>>before.
>>>
>>>Hope this helps!
>>>
>>>--
>>>Regards,
>>>Kristofer Gafvert
>>>http://www.gafvert.info/iis/ - IIS Related Info
>>>
>>>
>>>Brad wrote:
>>>
>>>>Hey All,
>>>>
>>>>I have a task that is proving difficult to master. I have over 200 IIS
>>>>servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
>>>>2003).
>>>>On each server, for each site, I need to:
>>>>
>>>>1) Disable directory browsing if it is enabled
>>>>2) Set logging format WC3 format if it isn't already
>>>>3) List all the virtual directories per site and delete if it matches
>>>>known
>>>>directories that aren't permitted
>>>>4) Set "Enable Parent Paths" to disabled
>>>>
>>>>I also need to do this on the server level as well, to ensure new sites
>>>>are
>>>>not created with the wrong values.
>>>>
>>>>Any examples on doing this type of stuff apreciated!
>>>>
>>>>TIA,
>>>>Brad
>>>
Re: Configure IIS using VBScript?
am 15.11.2007 18:57:01 von bds
Cool. I have written this and it works pefectly. One last thing though
before I post the code here.
How can I get the following code to work against a remote machine?
strFullPath = "IIS://LocalHost/W3SVC"
Set objServer = GetObject(strFullPath) 'Bind to Web Server
I basically want to do:
strFullPath = "IIS://SOMESERVER/W3SVC"
Set objServer = GetObject(strFullPath) 'Bind to Web Server
Can you create ADSI Objects on a remote server?
Brad
"Kristofer Gafvert" wrote:
> Hi,
>
> Sorry for my late reply, i have had many other things to do.
>
> "level" is not part of the metabase. It is only a variable used in the
> script.
>
> The scripts runs until it cannot find any more IIsWebVirtualDir (or
> IIsWebDirectory). It is the For Each clause doing this.
>
> The matrix is correct. But...a physical folder is not automatically a
> IIsWebDirectory. By default, it is not part of the metabase at all which
> means you cannot enumerate the metabase to check the name of a physical
> folder (unless you know that each folder is a IIsWebDirectory). You need
> to check the file system.
>
>
> --
> Regards,
> Kristofer Gafvert
> http://www.gafvert.info/iis/ - IIS Related Info
>
>
> Brad wrote:
>
> >Thanks to the stuff you gave me, mainly the IISFAQ.COM stuff I have now got
> >this to report each setting. I will work on getting it to change settings
> >tomorrow and update accordingly.
> >
> >A couple fo questions though, how does the "Level" variable work? I don't
> >seem to be able to find much doco on it. I understand what it represents,
> >and that incrementing it means you move 1 Level further down the tree, but
> >couldn't find it listed in MetaBase Explorer for example. I also would have
> >thought there should be some sort of counter to stop the script trying to
> >recurse past the last level. Looking at it as it stands it calls itself
> >forever although the script actually behaves the way you would want it too
> >and doesn't error.
> >
> >Also, I gather that I can configure the required values according to the
> >matrix below?
> >
> > Server Site Virtual Folder Physical Folder
> >Directory Browsing YES YES YES YES
> >ASP Enable Paths YES YES YES YES
> >Log Format YES YES NO NO
> >
> >Does that look about right?
> >
> >Again, thanks a lot for youe help.
> >Brad
> >
> >"Brad" wrote:
> >
> >>Kristofer,
> >>
> >>Thanks for all that, I will digest it now and see how I go but it seem
> >>that
> >>you have covered most things (even the annoying bit about no WMI on IIS
> >>5.0)
> >>
> >>Thanks again.
> >>
> >>"Kristofer Gafvert" wrote:
> >>
> >>>Hi,
> >>>
> >>>Have you seen the IIS script center? It has many useful examples:
> >>>
> >>>http://www.microsoft.com/technet/scriptcenter/scripts/iis /default.mspx?mfr=true
> >>>
> >>>Do note however that the scripts for IIS 6 uses WMI, which cannot be used
> >>>for IIS 5. You can however use ADSI for both IIS versions.
> >>>
> >>>Below i give you the metabase properties you want to change
> >>>
> >>>1) DirBrowseFlags
> >>>http://msdn2.microsoft.com/en-us/library/ms524576.aspx
> >>>
> >>>2) LogPluginClsid, also check LogType
> >>>http://msdn2.microsoft.com/en-us/library/ms524325.aspx
> >>>http://msdn2.microsoft.com/en-us/library/ms525274.aspx
> >>>http://msdn2.microsoft.com/en-us/library/ms524877.aspx
> >>>
> >>>3) Enumerate the virtual directories and check each one.
> >>>ADSI: http://www.iisfaq.com/Default.aspx?tabid=2745
> >>>WMI: http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
> >>>
> >>>4) AspEnableParentPaths
> >>>http://msdn2.microsoft.com/en-us/library/ms524697.aspx
> >>>
> >>>
> >>>How much help do you need (what level are you on)? With the above
> >>>information, can you put together something?
> >>>
> >>>If you want to set it on the server level, you basically set the metabase
> >>>property on the /LM/W3SVC node to the correct value.
> >>>
> >>>As always, when changing the metabase, i recommend you to back it up
> >>>before.
> >>>
> >>>Hope this helps!
> >>>
> >>>--
> >>>Regards,
> >>>Kristofer Gafvert
> >>>http://www.gafvert.info/iis/ - IIS Related Info
> >>>
> >>>
> >>>Brad wrote:
> >>>
> >>>>Hey All,
> >>>>
> >>>>I have a task that is proving difficult to master. I have over 200 IIS
> >>>>servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
> >>>>2003).
> >>>>On each server, for each site, I need to:
> >>>>
> >>>>1) Disable directory browsing if it is enabled
> >>>>2) Set logging format WC3 format if it isn't already
> >>>>3) List all the virtual directories per site and delete if it matches
> >>>>known
> >>>>directories that aren't permitted
> >>>>4) Set "Enable Parent Paths" to disabled
> >>>>
> >>>>I also need to do this on the server level as well, to ensure new sites
> >>>>are
> >>>>not created with the wrong values.
> >>>>
> >>>>Any examples on doing this type of stuff apreciated!
> >>>>
> >>>>TIA,
> >>>>Brad
> >>>
>
Re: Configure IIS using VBScript?
am 15.11.2007 19:11:02 von Kristofer Gafvert
Your example should work.
ADSI must however be installed on both the local and remote machine. And
you also need to run the script with a user account that has necessary
credentials on the remote machine.
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
Brad wrote:
>Cool. I have written this and it works pefectly. One last thing though
>before I post the code here.
>
>How can I get the following code to work against a remote machine?
>
>strFullPath = "IIS://LocalHost/W3SVC"
>Set objServer = GetObject(strFullPath) 'Bind to Web Server
>
>I basically want to do:
>
>strFullPath = "IIS://SOMESERVER/W3SVC"
>Set objServer = GetObject(strFullPath) 'Bind to Web Server
>
>Can you create ADSI Objects on a remote server?
>
>Brad
>
>
>"Kristofer Gafvert" wrote:
>
>>Hi,
>>
>>Sorry for my late reply, i have had many other things to do.
>>
>>"level" is not part of the metabase. It is only a variable used in the
>>script.
>>
>>The scripts runs until it cannot find any more IIsWebVirtualDir (or
>>IIsWebDirectory). It is the For Each clause doing this.
>>
>>The matrix is correct. But...a physical folder is not automatically a
>>IIsWebDirectory. By default, it is not part of the metabase at all which
>>means you cannot enumerate the metabase to check the name of a physical
>>folder (unless you know that each folder is a IIsWebDirectory). You need
>>to check the file system.
>>
>>
>>--
>>Regards,
>>Kristofer Gafvert
>>http://www.gafvert.info/iis/ - IIS Related Info
>>
>>
>>Brad wrote:
>>
>>>Thanks to the stuff you gave me, mainly the IISFAQ.COM stuff I have now
>>>got
>>>this to report each setting. I will work on getting it to change
>>>settings
>>>tomorrow and update accordingly.
>>>
>>>A couple fo questions though, how does the "Level" variable work? I
>>>don't
>>>seem to be able to find much doco on it. I understand what it
>>>represents,
>>>and that incrementing it means you move 1 Level further down the tree,
>>>but
>>>couldn't find it listed in MetaBase Explorer for example. I also would
>>>have
>>>thought there should be some sort of counter to stop the script trying to
>>>recurse past the last level. Looking at it as it stands it calls itself
>>>forever although the script actually behaves the way you would want it
>>>too
>>>and doesn't error.
>>>
>>>Also, I gather that I can configure the required values according to the
>>>matrix below?
>>>
>>> Server Site Virtual Folder Physical Folder
>>>Directory Browsing YES YES YES YES
>>>ASP Enable Paths YES YES YES YES
>>>Log Format YES YES NO NO
>>>
>>>Does that look about right?
>>>
>>>Again, thanks a lot for youe help.
>>>Brad
>>>
>>>"Brad" wrote:
>>>
>>>>Kristofer,
>>>>
>>>>Thanks for all that, I will digest it now and see how I go but it seem
>>>>that
>>>>you have covered most things (even the annoying bit about no WMI on IIS
>>>>5.0)
>>>>
>>>>Thanks again.
>>>>
>>>>"Kristofer Gafvert" wrote:
>>>>
>>>>>Hi,
>>>>>
>>>>>Have you seen the IIS script center? It has many useful examples:
>>>>>
>>>>>http://www.microsoft.com/technet/scriptcenter/scripts/i is/default.mspx?mfr=true
>>>>>
>>>>>Do note however that the scripts for IIS 6 uses WMI, which cannot be
>>>>>used
>>>>>for IIS 5. You can however use ADSI for both IIS versions.
>>>>>
>>>>>Below i give you the metabase properties you want to change
>>>>>
>>>>>1) DirBrowseFlags
>>>>>http://msdn2.microsoft.com/en-us/library/ms524576.aspx
>>>>>
>>>>>2) LogPluginClsid, also check LogType
>>>>>http://msdn2.microsoft.com/en-us/library/ms524325.aspx
>>>>>http://msdn2.microsoft.com/en-us/library/ms525274.aspx
>>>>>http://msdn2.microsoft.com/en-us/library/ms524877.aspx
>>>>>
>>>>>3) Enumerate the virtual directories and check each one.
>>>>>ADSI: http://www.iisfaq.com/Default.aspx?tabid=2745
>>>>>WMI: http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
>>>>>
>>>>>4) AspEnableParentPaths
>>>>>http://msdn2.microsoft.com/en-us/library/ms524697.aspx
>>>>>
>>>>>
>>>>>How much help do you need (what level are you on)? With the above
>>>>>information, can you put together something?
>>>>>
>>>>>If you want to set it on the server level, you basically set the
>>>>>metabase
>>>>>property on the /LM/W3SVC node to the correct value.
>>>>>
>>>>>As always, when changing the metabase, i recommend you to back it up
>>>>>before.
>>>>>
>>>>>Hope this helps!
>>>>>
>>>>>--
>>>>>Regards,
>>>>>Kristofer Gafvert
>>>>>http://www.gafvert.info/iis/ - IIS Related Info
>>>>>
>>>>>
>>>>>Brad wrote:
>>>>>
>>>>>>Hey All,
>>>>>>
>>>>>>I have a task that is proving difficult to master. I have over 200
>>>>>>IIS
>>>>>>servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
>>>>>>2003).
>>>>>>On each server, for each site, I need to:
>>>>>>
>>>>>>1) Disable directory browsing if it is enabled
>>>>>>2) Set logging format WC3 format if it isn't already
>>>>>>3) List all the virtual directories per site and delete if it matches
>>>>>>known
>>>>>>directories that aren't permitted
>>>>>>4) Set "Enable Parent Paths" to disabled
>>>>>>
>>>>>>I also need to do this on the server level as well, to ensure new sites
>>>>>>
>>>>>>are
>>>>>>not created with the wrong values.
>>>>>>
>>>>>>Any examples on doing this type of stuff apreciated!
>>>>>>
>>>>>>TIA,
>>>>>>Brad
>>>>>
>>
Re: Configure IIS using VBScript?
am 16.11.2007 15:07:09 von David Wang
And the firewall ports for DCOM have to be open (Windows Server 2003
installs with Firewall enabled).
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
On Nov 15, 10:11 am, "Kristofer Gafvert"
wrote:
> Your example should work.
>
> ADSI must however be installed on both the local and remote machine. And
> you also need to run the script with a user account that has necessary
> credentials on the remote machine.
>
> --
> Regards,
> Kristofer Gafverthttp://www.gafvert.info/iis/- IIS Related Info
>
>
>
> Brad wrote:
> >Cool. I have written this and it works pefectly. One last thing though
> >before I post the code here.
>
> >How can I get the following code to work against a remote machine?
>
> >strFullPath = "IIS://LocalHost/W3SVC"
> >Set objServer = GetObject(strFullPath) 'Bind to Web Server
>
> >I basically want to do:
>
> >strFullPath = "IIS://SOMESERVER/W3SVC"
> >Set objServer = GetObject(strFullPath) 'Bind to Web Server
>
> >Can you create ADSI Objects on a remote server?
>
> >Brad
>
> >"Kristofer Gafvert" wrote:
>
> >>Hi,
>
> >>Sorry for my late reply, i have had many other things to do.
>
> >>"level" is not part of the metabase. It is only a variable used in the
> >>script.
>
> >>The scripts runs until it cannot find any more IIsWebVirtualDir (or
> >>IIsWebDirectory). It is the For Each clause doing this.
>
> >>The matrix is correct. But...a physical folder is not automatically a
> >>IIsWebDirectory. By default, it is not part of the metabase at all which
> >>means you cannot enumerate the metabase to check the name of a physical
> >>folder (unless you know that each folder is a IIsWebDirectory). You need
> >>to check the file system.
>
> >>--
> >>Regards,
> >>Kristofer Gafvert
> >>http://www.gafvert.info/iis/- IIS Related Info
>
> >>Brad wrote:
>
> >>>Thanks to the stuff you gave me, mainly the IISFAQ.COM stuff I have now
> >>>got
> >>>this to report each setting. I will work on getting it to change
> >>>settings
> >>>tomorrow and update accordingly.
>
> >>>A couple fo questions though, how does the "Level" variable work? I
> >>>don't
> >>>seem to be able to find much doco on it. I understand what it
> >>>represents,
> >>>and that incrementing it means you move 1 Level further down the tree,
> >>>but
> >>>couldn't find it listed in MetaBase Explorer for example. I also would
> >>>have
> >>>thought there should be some sort of counter to stop the script trying to
> >>>recurse past the last level. Looking at it as it stands it calls itself
> >>>forever although the script actually behaves the way you would want it
> >>>too
> >>>and doesn't error.
>
> >>>Also, I gather that I can configure the required values according to the
> >>>matrix below?
>
> >>> Server Site Virtual Folder Physical Folder
> >>>Directory Browsing YES YES YES YES
> >>>ASP Enable Paths YES YES YES YES
> >>>Log Format YES YES NO NO
>
> >>>Does that look about right?
>
> >>>Again, thanks a lot for youe help.
> >>>Brad
>
> >>>"Brad" wrote:
>
> >>>>Kristofer,
>
> >>>>Thanks for all that, I will digest it now and see how I go but it seem
> >>>>that
> >>>>you have covered most things (even the annoying bit about no WMI on IIS
> >>>>5.0)
>
> >>>>Thanks again.
>
> >>>>"Kristofer Gafvert" wrote:
>
> >>>>>Hi,
>
> >>>>>Have you seen the IIS script center? It has many useful examples:
>
> >>>>>http://www.microsoft.com/technet/scriptcenter/scripts/i is/default.msp...
>
> >>>>>Do note however that the scripts for IIS 6 uses WMI, which cannot be
> >>>>>used
> >>>>>for IIS 5. You can however use ADSI for both IIS versions.
>
> >>>>>Below i give you the metabase properties you want to change
>
> >>>>>1) DirBrowseFlags
> >>>>>http://msdn2.microsoft.com/en-us/library/ms524576.aspx
>
> >>>>>2) LogPluginClsid, also check LogType
> >>>>>http://msdn2.microsoft.com/en-us/library/ms524325.aspx
> >>>>>http://msdn2.microsoft.com/en-us/library/ms525274.aspx
> >>>>>http://msdn2.microsoft.com/en-us/library/ms524877.aspx
>
> >>>>>3) Enumerate the virtual directories and check each one.
> >>>>>ADSI:http://www.iisfaq.com/Default.aspx?tabid=2745
> >>>>>WMI:http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
>
> >>>>>4) AspEnableParentPaths
> >>>>>http://msdn2.microsoft.com/en-us/library/ms524697.aspx
>
> >>>>>How much help do you need (what level are you on)? With the above
> >>>>>information, can you put together something?
>
> >>>>>If you want to set it on the server level, you basically set the
> >>>>>metabase
> >>>>>property on the /LM/W3SVC node to the correct value.
>
> >>>>>As always, when changing the metabase, i recommend you to back it up
> >>>>>before.
>
> >>>>>Hope this helps!
>
> >>>>>--
> >>>>>Regards,
> >>>>>Kristofer Gafvert
> >>>>>http://www.gafvert.info/iis/- IIS Related Info
>
> >>>>>Brad wrote:
>
> >>>>>>Hey All,
>
> >>>>>>I have a task that is proving difficult to master. I have over 200
> >>>>>>IIS
> >>>>>>servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
> >>>>>>2003).
> >>>>>>On each server, for each site, I need to:
>
> >>>>>>1) Disable directory browsing if it is enabled
> >>>>>>2) Set logging format WC3 format if it isn't already
> >>>>>>3) List all the virtual directories per site and delete if it matches
> >>>>>>known
> >>>>>>directories that aren't permitted
> >>>>>>4) Set "Enable Parent Paths" to disabled
>
> >>>>>>I also need to do this on the server level as well, to ensure new sites
>
> >>>>>>are
> >>>>>>not created with the wrong values.
>
> >>>>>>Any examples on doing this type of stuff apreciated!
>
> >>>>>>TIA,
> >>>>>>Brad- Hide quoted text -
>
> - Show quoted text -
Re: Configure IIS using VBScript?
am 16.11.2007 17:32:00 von bds
For now I have settled for a psexec session and running the script locally
(still totally automated). The fleet of over 300 servers I am running this
on is standardised to a good extent, but not so good that these config items
can be relied upon, and the effort for changing them would be more than doing
this task manually.
I have decided not to post the code here (it is over 300 lines now) but am
happy to share it with anyone that requests it via this thread.
"David Wang" wrote:
> And the firewall ports for DCOM have to be open (Windows Server 2003
> installs with Firewall enabled).
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
>
>
>
> On Nov 15, 10:11 am, "Kristofer Gafvert"
> wrote:
> > Your example should work.
> >
> > ADSI must however be installed on both the local and remote machine. And
> > you also need to run the script with a user account that has necessary
> > credentials on the remote machine.
> >
> > --
> > Regards,
> > Kristofer Gafverthttp://www.gafvert.info/iis/- IIS Related Info
> >
> >
> >
> > Brad wrote:
> > >Cool. I have written this and it works pefectly. One last thing though
> > >before I post the code here.
> >
> > >How can I get the following code to work against a remote machine?
> >
> > >strFullPath = "IIS://LocalHost/W3SVC"
> > >Set objServer = GetObject(strFullPath) 'Bind to Web Server
> >
> > >I basically want to do:
> >
> > >strFullPath = "IIS://SOMESERVER/W3SVC"
> > >Set objServer = GetObject(strFullPath) 'Bind to Web Server
> >
> > >Can you create ADSI Objects on a remote server?
> >
> > >Brad
> >
> > >"Kristofer Gafvert" wrote:
> >
> > >>Hi,
> >
> > >>Sorry for my late reply, i have had many other things to do.
> >
> > >>"level" is not part of the metabase. It is only a variable used in the
> > >>script.
> >
> > >>The scripts runs until it cannot find any more IIsWebVirtualDir (or
> > >>IIsWebDirectory). It is the For Each clause doing this.
> >
> > >>The matrix is correct. But...a physical folder is not automatically a
> > >>IIsWebDirectory. By default, it is not part of the metabase at all which
> > >>means you cannot enumerate the metabase to check the name of a physical
> > >>folder (unless you know that each folder is a IIsWebDirectory). You need
> > >>to check the file system.
> >
> > >>--
> > >>Regards,
> > >>Kristofer Gafvert
> > >>http://www.gafvert.info/iis/- IIS Related Info
> >
> > >>Brad wrote:
> >
> > >>>Thanks to the stuff you gave me, mainly the IISFAQ.COM stuff I have now
> > >>>got
> > >>>this to report each setting. I will work on getting it to change
> > >>>settings
> > >>>tomorrow and update accordingly.
> >
> > >>>A couple fo questions though, how does the "Level" variable work? I
> > >>>don't
> > >>>seem to be able to find much doco on it. I understand what it
> > >>>represents,
> > >>>and that incrementing it means you move 1 Level further down the tree,
> > >>>but
> > >>>couldn't find it listed in MetaBase Explorer for example. I also would
> > >>>have
> > >>>thought there should be some sort of counter to stop the script trying to
> > >>>recurse past the last level. Looking at it as it stands it calls itself
> > >>>forever although the script actually behaves the way you would want it
> > >>>too
> > >>>and doesn't error.
> >
> > >>>Also, I gather that I can configure the required values according to the
> > >>>matrix below?
> >
> > >>> Server Site Virtual Folder Physical Folder
> > >>>Directory Browsing YES YES YES YES
> > >>>ASP Enable Paths YES YES YES YES
> > >>>Log Format YES YES NO NO
> >
> > >>>Does that look about right?
> >
> > >>>Again, thanks a lot for youe help.
> > >>>Brad
> >
> > >>>"Brad" wrote:
> >
> > >>>>Kristofer,
> >
> > >>>>Thanks for all that, I will digest it now and see how I go but it seem
> > >>>>that
> > >>>>you have covered most things (even the annoying bit about no WMI on IIS
> > >>>>5.0)
> >
> > >>>>Thanks again.
> >
> > >>>>"Kristofer Gafvert" wrote:
> >
> > >>>>>Hi,
> >
> > >>>>>Have you seen the IIS script center? It has many useful examples:
> >
> > >>>>>http://www.microsoft.com/technet/scriptcenter/scripts/i is/default.msp...
> >
> > >>>>>Do note however that the scripts for IIS 6 uses WMI, which cannot be
> > >>>>>used
> > >>>>>for IIS 5. You can however use ADSI for both IIS versions.
> >
> > >>>>>Below i give you the metabase properties you want to change
> >
> > >>>>>1) DirBrowseFlags
> > >>>>>http://msdn2.microsoft.com/en-us/library/ms524576.aspx
> >
> > >>>>>2) LogPluginClsid, also check LogType
> > >>>>>http://msdn2.microsoft.com/en-us/library/ms524325.aspx
> > >>>>>http://msdn2.microsoft.com/en-us/library/ms525274.aspx
> > >>>>>http://msdn2.microsoft.com/en-us/library/ms524877.aspx
> >
> > >>>>>3) Enumerate the virtual directories and check each one.
> > >>>>>ADSI:http://www.iisfaq.com/Default.aspx?tabid=2745
> > >>>>>WMI:http://blog.crowe.co.nz/archive/2005/08/09/196.aspx
> >
> > >>>>>4) AspEnableParentPaths
> > >>>>>http://msdn2.microsoft.com/en-us/library/ms524697.aspx
> >
> > >>>>>How much help do you need (what level are you on)? With the above
> > >>>>>information, can you put together something?
> >
> > >>>>>If you want to set it on the server level, you basically set the
> > >>>>>metabase
> > >>>>>property on the /LM/W3SVC node to the correct value.
> >
> > >>>>>As always, when changing the metabase, i recommend you to back it up
> > >>>>>before.
> >
> > >>>>>Hope this helps!
> >
> > >>>>>--
> > >>>>>Regards,
> > >>>>>Kristofer Gafvert
> > >>>>>http://www.gafvert.info/iis/- IIS Related Info
> >
> > >>>>>Brad wrote:
> >
> > >>>>>>Hey All,
> >
> > >>>>>>I have a task that is proving difficult to master. I have over 200
> > >>>>>>IIS
> > >>>>>>servers, a healthy mix of IIS 5.0 (Windows 2000) and IIS 6.0 (Windows
> > >>>>>>2003).
> > >>>>>>On each server, for each site, I need to:
> >
> > >>>>>>1) Disable directory browsing if it is enabled
> > >>>>>>2) Set logging format WC3 format if it isn't already
> > >>>>>>3) List all the virtual directories per site and delete if it matches
> > >>>>>>known
> > >>>>>>directories that aren't permitted
> > >>>>>>4) Set "Enable Parent Paths" to disabled
> >
> > >>>>>>I also need to do this on the server level as well, to ensure new sites
> >
> > >>>>>>are
> > >>>>>>not created with the wrong values.
> >
> > >>>>>>Any examples on doing this type of stuff apreciated!
> >
> > >>>>>>TIA,
> > >>>>>>Brad- Hide quoted text -
> >
> > - Show quoted text -
>
>