Solved

Get configured log file locations for web sites

Posted on 2008-10-31
7
459 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 1

Author Comment

by:DerivcoIT
Comment Utility
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
Comment Utility
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
Comment Utility
no objections
0
 
LVL 1

Author Comment

by:DerivcoIT
Comment Utility
..
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

14 Experts available now in Live!

Get 1:1 Help Now