Search code examples
.netwindowsiiswmi

How to get IIS application info via WMI


How would I get the actual directory path of an IIS application (virtual folder) using WMI?


Solution

  • Use Scriptomatic V2 tools to view more samples like that :

    On Error Resume Next

    Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20

    arrComputers = Array("*") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "=========================================="

    Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\MicrosoftIISv2") Set colItems = objWMIService.ExecQuery("SELECT * FROM IIsWebVirtualDir_IIsWebVirtualDir", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly)

    For Each objItem In colItems WScript.Echo "GroupComponent: " & objItem.GroupComponent WScript.Echo "PartComponent: " & objItem.PartComponent WScript.Echo Next Next