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
81 ' First of all look for the FileExtension
82 Set WshShell = CreateObject("WScript.Shell")
84 regValue = WshShell.RegRead("HKLM\SOFTWARE\Shibboleth\FileExtension")
86 ' Registry key is still there - this is an upgrade, so exit
89 ' Key is gone - a pure uninstall
91 'Don't show errors, we'll handle anything important
94 'Attempt to get W3SVC. If failure, end script (e.g. IIS isn't available)
95 Set WebObj = GetObject("IIS://LocalHost/W3SVC")
98 'Get the INSTALLDIR value via CustomActionData
99 InstallDir = Session.Property("CustomActionData")
101 'Remove all trailing backslashes to normalize
102 do while (mid(InstallDir,Len(InstallDir),1) = "\")
103 InstallDir = mid(InstallDir,1,Len(InstallDir)-1)
105 ShibISAPIPath = InstallDir & "\lib\shibboleth\isapi_shib.dll"
108 'First do the master service
109 DeleteISAPIFilters "IIS://LocalHost/W3SVC",ShibISAPIPath
111 for each site in WebObj
112 if (site.Class = "IIsWebServer") then
113 sitePath = "IIS://LocalHost/W3SVC/" & site.Name
114 DeleteISAPIFilters sitePath,ShibISAPIPath
118 'Delete File Extensions
119 'First do the master service
120 DeleteFileExtensions WebObj,ShibISAPIPath
122 for each site in WebObj
123 if (site.Class = "IIsWebServer") then
124 set siteObj = GetObject("IIS://LocalHost/W3SVC/" & site.Name & "/ROOT")
125 DeleteFileExtensions siteObj,ShibISAPIPath
129 'Delete Web Services Extension (universal, no need to do for each site)
130 WebObj.DeleteExtensionFileRecord ShibISAPIPath
133 ' Sense whether this is an upgrade