Solved

Get configured log file locations for web sites

Posted on 2008-10-31
7
462 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
  • 5
7 Comments
 
LVL 14

Assisted Solution

by:top_rung
top_rung earned 100 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 400 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

943 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now