• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

How to get an ADSI reference to an IIS subdirectory?

My default website in IIS6 isn't anything special: I have a few subdirectories below the root (/css, /images), some files across the site, and that's it.  I don't have any virtual directories configured.

I want to programmatically set the content expiration on the [/css] and [/images].  I have some code written below, but the script fails on the GetObject() call.  What am I doing wrong?
Dim oIIsImagesDir
set oIIsImagesDir = GetObject("IIS://localhost/W3SVC/1/ROOT/css")
 
if IsObject(oIIsImagesDir) then
	WScript.Echo("hi")
	'Call WScript.Echo("oIIsImagesDir.HttpExpires = " & oIIsImagesDir.HttpExpires)
	'oIIsImagesDir.HttpExpires= "D, 0x15180"
end if

Open in new window

0
deathtospam
Asked:
deathtospam
1 Solution
 
PakaCommented:
If you run the script via cscript - what's the error number that is shown?  Google should get you the solution from there...  Off-hand, it's likely to be a permissions issue.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now