1 Sub DeleteISAPIFilters(IISPath,dllPath)
3 Dim filter, FiltersObj, LoadOrder, FilterArray, FilterItem
5 Set FiltersObj = GetObject(IISPath & "/Filters")
6 LoadOrder = FiltersObj.FilterLoadOrder
8 for each filter in FiltersObj
9 if (filter.Class = "IIsFilter") then
10 if (filter.FilterPath = dllPath) then
12 'Delete the found filter here
13 'If there's anything to potentially delete...
14 if (LoadOrder <> "") then
15 FilterArray = split(LoadOrder,",")
17 for each FilterItem in FilterArray
18 if (FilterItem <> filter.Name) then
19 LoadOrder = LoadOrder & FilterItem & ","
22 'Remove trailing comma if any filters were kept
23 if (LoadOrder <> "") then
24 LoadOrder = mid(LoadOrder,1,len(LoadOrder)-1)
27 'Set the Load Order to the new shibboleth-less order
28 if (FiltersObj.FilterLoadOrder <> LoadOrder) then
29 FiltersObj.FilterLoadOrder = LoadOrder
34 'Delete the actual IISFilter object
35 FiltersObj.Delete "IIsFilter",filter.Name
44 Sub DeleteFileExtensions(siteObj, dllPath)
46 Dim ScriptMaps, newScriptMaps
47 Dim line, lineArray, lineIndex
51 ScriptMaps = siteObj.ScriptMaps
52 redim newScriptMaps(0)
54 'copy each entry from the old ScriptMaps to newScriptMaps
55 'unless it is for dllPath
56 for each line in ScriptMaps
57 lineArray = split(line,",")
58 if (lineArray(1) <> dllPath) then
59 redim preserve newScriptMaps(lineIndex)
60 newScriptMaps(lineIndex) = line
61 lineIndex = lineIndex + 1
66 'If we found dllPath, then use the newScriptMaps instead
67 if (existsFlag = "exists") then
68 siteObj.ScriptMaps = newScriptMaps
75 '*** Begin Main Code ***
79 Dim site, siteObj, sitePath
82 'Don't show errors, we'll handle anything important
85 'Attempt to get W3SVC. If failure, end script (e.g. IIS isn't available)
86 Set WebObj = GetObject("IIS://LocalHost/W3SVC")
89 'Get the INSTALLDIR value via CustomActionData
90 InstallDir = Session.Property("CustomActionData")
92 'Remove all trailing backslashes to normalize
93 do while (mid(InstallDir,Len(InstallDir),1) = "\")
94 InstallDir = mid(InstallDir,1,Len(InstallDir)-1)
96 ShibISAPIPath = InstallDir & "\libexec\isapi_shib.dll"
99 'First do the master service
100 DeleteISAPIFilters "IIS://LocalHost/W3SVC",ShibISAPIPath
102 for each site in WebObj
103 if (site.Class = "IIsWebServer") then
104 sitePath = "IIS://LocalHost/W3SVC/" & site.Name
105 DeleteISAPIFilters sitePath,ShibISAPIPath
109 'Delete File Extensions
110 'First do the master service
111 DeleteFileExtensions WebObj,ShibISAPIPath
113 for each site in WebObj
114 if (site.Class = "IIsWebServer") then
115 set siteObj = GetObject("IIS://LocalHost/W3SVC/" & site.Name & "/ROOT")
116 DeleteFileExtensions siteObj,ShibISAPIPath
121 'Delete Web Services Extension (universal, no need to do for each site)
122 WebObj.DeleteExtensionFileRecord ShibISAPIPath