We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

How to get an ADSI reference to an IIS subdirectory?

Medium Priority
468 Views
Last Modified: 2012-05-06
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

Comment
Watch Question

Commented:
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.