Solved

Get configured log file locations for web sites

Posted on 2008-10-31
7
468 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
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.

 
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

Suggested Solutions

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…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

839 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