How to read an IIS 6 Website's Directory Structure using WMI?

前端 未结 2 425
梦毁少年i
梦毁少年i 2021-02-10 09:38

I need to read a website\'s folders using WMI and C# in IIS 6.0. I am able to read the Virtual directories and applications using the \"IISWebVirtualDirSetting\

2条回答
  •  逝去的感伤
    2021-02-10 10:02

    Never mind. i got it myself. If the directory structure is on local system the System.IO.DirectoryInfo is what is needed. Using remoting the same can be used for remote server as well.

    Reference: http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx

    If WMi has to be there then Win32_Directory is the class which should used in query:

    "Select * from Win32_directory where drive ='"+ DriveLetter +":' and Path ='%" + MyPath + "%'";
    

    Reference: http://msdn.microsoft.com/en-us/library/aa394130(VS.85).aspx

提交回复
热议问题