欢迎光临
我们一直在努力

WSH Script to remove un-needed IIS Script-Mappings using ADSI

建站超值云服务器,限时71元/月

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  

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » WSH Script to remove un-needed IIS Script-Mappings using ADSI
分享到: 更多 (0)

相关推荐

  • 暂无文章