Retrieving IIS website name from W3SCVn id...

  • Thread starter Thread starter Rob Meade
  • Start date Start date
R

Rob Meade

Hi all,

I need to iterate through a directory on a server which contains a folder
for each of the websites within IIS, each directory has the name of the
website under IIS, the name being the W3SCVn id, the n being an identifying
number....is it possible to query IIS via .net to retrieve the website name
I've given the website, for example...

W3SCV1 - "Default Web Site"

Any suggestions welcomed.

Regards

Rob
 
I think I would go about it a little differently, I would try to use
the WMI provider for IIS to query IIS about the websites it hosts.

See
http://msdn.microsoft.com/library/d...html/833f75ec-41da-416c-8b44-d9cf069fc528.asp
(and its parent page) for further information about the IIS WMI
provider.

You should be able to access WMI from .NET through the classes in the
namespace System.Management. This looks like a promising article:
http://msdn.microsoft.com/library/d...managementinformationwithsystemmanagement.asp

Mike
 
...
I think I would go about it a little differently, I would try to use
the WMI provider for IIS to query IIS about the websites it hosts.

Hi Mike,

Many thanks for your reply and links - alas, not being that adept yet I
wasn't entirely sure what I was looking at. :o/

I have found out thus far that I could use DirectoryServices to query the
Active Directory, and IIS, but I haven't yet found an article that does what
I need, I've found a few that list the applications under a website, but not
websites under IIS if you know what I mean.

I'm already using some code to query the AD for nt user lookups, so was
hoping it might be similar (and thus I'd understand it!)...

Thanks again for your reply.

Regards

Rob
 
There's a ton of sample WMI queries included with PrimalScript, a
script editor tool you can download and run as a 45-day trial. Go to
www.primalscript.com and get any of the editions of PrimalScript there,
then look for the WMI Wizard when you get in there. The queries should
be usable inside .NET somehow.

Hey, I haven't done this particular thing either, but keep exploring
that IIS area in MSDN until you find what you need - with that and the
sample script code from PrimalScript, you oughta get there sooner or
later!

Mike
 
...
Hey, I haven't done this particular thing either, but keep exploring
that IIS area in MSDN until you find what you need - with that and the
sample script code from PrimalScript, you oughta get there sooner or
later!

Cheers :o)

Rob
 
Back
Top