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
	'Call WScript.Echo("oIIsImagesDir.HttpExpires = " & oIIsImagesDir.HttpExpires)
	'oIIsImagesDir.HttpExpires= "D, 0x15180"
end if

Open in new window

Mass Dot NetAsked:
Who is Participating?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.