?
Solved

Get configured log file locations for web sites

Posted on 2008-10-31
7
Medium Priority
?
480 Views
Last Modified: 2012-06-27
Hi,
Im writing a script to move IIS logs onto central storage for analysis. The problem is that we have 100s of sites and the log file directories are not standard. What Id like to do is enumerate these directories using WM. Ive looked @ the MicrosoftIISV2 namespace but am unable to find the class that contains this information?? Is there any other namespace or class that holds this info or have I missed something?

Thanks
Gary
0
Comment
Question by:DerivcoIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
7 Comments
 
LVL 14

Assisted Solution

by:top_rung
top_rung earned 400 total points
ID: 22848578
Stab in the semi-lit dark....How about utilizing the IIS metabase for the info?

http://www.windowsdevcenter.com/pub/a/windows/2004/07/13/iis_metabase.html?page=2

0
 
LVL 1

Author Comment

by:DerivcoIT
ID: 22849156
I have this, but now need to loop through all other virtual directories by web site ID

Dim IISOBJ, Servername, WebSiteID
ServerName = "localhost"
WebSiteID = 1
Set IISOBJ = GetObject("IIS://" & ServerName & "/W3SVC/" & WebSiteID)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(IISOBJ.LogFileDirectory & "\W3SVC1")
WScript.Echo "LogFileDirectory          : " & IISOBJ.LogFileDirectory & "\W3SVC1"
0
 
LVL 10

Assisted Solution

by:harperse
harperse earned 1600 total points
ID: 22850615
IIS MVP Chris Crowe writes a lot of scripts regarding logging.  Here is a link to one that is a bit overkill, but from his site, you may be able to find something that suits you better, or adapt the one at the link.
http://www.iisfaq.com/Default.aspx?tabid=2809

Best of luck,
harperse
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:DerivcoIT
ID: 22865067
Thanks,
From a quick look, it seems this could be modified to suite our environment. Will let you know once have given it a more thorough look!
0
 
LVL 1

Accepted Solution

by:
DerivcoIT earned 0 total points
ID: 22866157
Thanks for the help...got what I needed from this!

 
 Dim IISObj, Object, ServicePath, Service,ServerName,ClassName
 Service="W3SVC"
 ClassName="IIsWebServer"
 ServerName="localhost"
 ServicePath = "IIS://" & ServerName & "/" & Service
 Set IISOBJ = GetObject(ServicePath)
 if (err <> 0) then
  WScript.Echo "Failed to read service " & Service & " for path " & Servicepath & " : " & _
   Err.Description & " (" & Err.Number & ")"
 end if
 for each object in IISOBJ
      if (Object.Class = ClassName) then
            WScript.echo "Site = " & Object.Name & " - " & Object.ServerComment & "Log Path is " & Service & Object.Name & " " & Object.LogFileDirectory
            WebSitepath = "IIS://" & Servername &"/"& Service & "/" & Object.Name
            Wscript.Echo WebSitepath
            WScript.Echo
  end if
 next
0
 
LVL 1

Author Comment

by:DerivcoIT
ID: 22866168
no objections
0
 
LVL 1

Author Comment

by:DerivcoIT
ID: 22866179
..
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
Learn about cloud computing and its benefits for small business owners.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question