Martin
Martin

Reputation: 40573

How to check if a IIS directory is virtual directory or not?

I am trying to find a way to write a script which will check if a IIS 6 directory is a virtual directory or not (see image below - I would like to see if TestMPIService is a virtual dir or not).

I tried with Powershell and WMI, but I am unable to find that information anywhere. Anybody has an idea how to do such thing?

alt text http://img518.imageshack.us/img518/7484/capturehwjvbx.png

Upvotes: 1

Views: 2355

Answers (2)

russau
russau

Reputation: 9088

This works for me on XP / IIS5.

adsutil.vbs GET W3SVC/1/ROOT/TestMPIService/KeyType
KeyType                         : (STRING) "IIsWebVirtualDir"

adsutil.vbs GET W3SVC/1/ROOT/aspnet_client/KeyType
KeyType                         : (STRING) "IIsWebDirectory" 

More about the adsutil here: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d3df4bc9-0954-459a-b5e6-7a8bc462960c.mspx?mfr=true

Upvotes: 0

elan
elan

Reputation: 163

Looks like you can use System.DirectoryServices.DirectoryEntries to read the IIS metabase. See here and here.

There is also a metabase.xml you can look at if you use IIS6.

Upvotes: 1

Related Questions