Solved

Get configured log file locations for web sites

Posted on 2008-10-31
7
469 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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