Getting all virtual directories for a IIS6 web site using WMI

血红的双手。 提交于 2019-12-02 00:58:55

Well, taking the simplest approach here and filtering based on the properties returned from your given example, I would probably opt to use the site identifier portion in the Name property:

Get-WmiObject IIsWebVirtualDir -namespace "ROOT\MicrosoftIISv2" | `
     Where-Object { $_.name -like "W3SVC/1/*" }

The above example only shows virtual directories on the default website that is set up with IIS first install. This always has the identifier 1.

Note: the backtick ` after the bar is the line continuation character (actually it's the escape character, but I'm escaping the EOL,) like _ in Visual Basic. I'm using this so the ugly horizontal scrollbars don't show up in the code block above.

-Oisin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!