this script removes un-needed script mappings on an iis 5.0 web server. script mappings are the isapi dlls or exes that execute webpages through iis. this script requires administrator access, and adsi 2.5 files. this script queries the iis metabase and returns a multi-valued array list. the script loops through the array and build a new set of script-mappings. we assume no responsibility for someone trying this script and any damages that may occur(try at own risk!). testing on a development machine is strongly recommend before running in a production environment. backing up the metabase is also strongly recommended.
here is the code
dim strext
dim myvalue
dim strnothing
dim strbuild
dim i
dim ivalue
set myvalue = getobject("iis://localhost/w3svc/1/root")
returns an array multi valued list
puts the values in a local array variable myarray
myarray = myvalue.get("scriptmaps")
loops through building a string
based on myarray list of values
for i = 0 to ubound(myarray)
ivalue = instr(myarray(i), ",")
strext = left(myarray(i), ivalue – 1)
select case strext
case ".idq", ".ida", ".printer", ".htw", ".htr"
builds a bogus string of un-needed mappings
strnothing = strnothing & myarray(i)
case else
builds a string of mappings with
the # as the delimiter
strbuild = strbuild & myarray(i) & "#"
end select
next
returns a 1-dimensinonal array based
on the string i build existing values
strbuild = split(strbuild, "#")
clears current script mappings in the metabase
myvalue.put "scriptmaps", vbnull
inserts values without un-needed mappings into metabase
myvalue.put "scriptmaps", strbuild
myvalue.setinfo
set myvalue = nothing
