1 Sub DeleteISAPIFilters(IISPath,dllPath)
\r
3 Dim filter, FiltersObj, LoadOrder, FilterArray, FilterItem
\r
6 Set FiltersObj = GetObject(IISPath & "/Filters")
\r
7 if IsNull(FiltersObj) then
\r
11 On Error Resume Next
\r
12 LoadOrder = FiltersObj.FilterLoadOrder
\r
13 if IsNull(LoadOrder) then
\r
17 for each filter in FiltersObj
\r
18 if (filter.Class = "IIsFilter") then
\r
19 if (filter.FilterPath = dllPath) then
\r
21 'Delete the found filter here
\r
22 'If there's anything to potentially delete...
\r
23 if (LoadOrder <> "") then
\r
24 FilterArray = split(LoadOrder,",")
\r
26 for each FilterItem in FilterArray
\r
27 if (FilterItem <> filter.Name) then
\r
28 LoadOrder = LoadOrder & FilterItem & ","
\r
31 'Remove trailing comma if any filters were kept
\r
32 if (LoadOrder <> "") then
\r
33 LoadOrder = mid(LoadOrder,1,len(LoadOrder)-1)
\r
36 'Set the Load Order to the new shibboleth-less order
\r
37 if (FiltersObj.FilterLoadOrder <> LoadOrder) then
\r
38 FiltersObj.FilterLoadOrder = LoadOrder
\r
43 'Delete the actual IISFilter object
\r
44 FiltersObj.Delete "IIsFilter",filter.Name
\r
53 Sub DeleteFileExtensions(siteObj, dllPath)
\r
55 Dim ScriptMaps, newScriptMaps
\r
56 Dim line, lineArray, lineIndex
\r
60 On Error Resume Next
\r
61 ScriptMaps = siteObj.ScriptMaps
\r
62 if IsNull(ScriptMaps) then
\r
65 redim newScriptMaps(0)
\r
67 'copy each entry from the old ScriptMaps to newScriptMaps
\r
68 'unless it is for dllPath
\r
69 for each line in ScriptMaps
\r
70 lineArray = split(line,",")
\r
71 if (lineArray(1) <> dllPath) then
\r
72 redim preserve newScriptMaps(lineIndex)
\r
73 newScriptMaps(lineIndex) = line
\r
74 lineIndex = lineIndex + 1
\r
76 existsFlag = "exists"
\r
79 'If we found dllPath, then use the newScriptMaps instead
\r
80 if (existsFlag = "exists") then
\r
81 siteObj.ScriptMaps = newScriptMaps
\r
87 Sub PerformUninstall()
\r
89 '*** Begin Main Code ***
\r
93 Dim site, siteObj, sitePath
\r
95 On Error Resume Next
\r
97 ' First of all look for the FileExtension
\r
98 Set WshShell = CreateObject("WScript.Shell")
\r
104 'Get the INSTALLDIR value via CustomActionData
\r
105 On Error Resume Next
\r
106 InstallDir = Session.Property("CustomActionData")
\r
111 On Error Resume Next
\r
112 regValue = WshShell.RegRead("HKLM\SOFTWARE\Shibboleth\FileExtension")
\r
115 ' Registry key is still there - this is an upgrade, so exit
\r
118 ' Key is gone - a pure uninstall
\r
120 'Don't show errors, we'll handle anything important
\r
121 On Error Resume Next
\r
123 'Attempt to get W3SVC. If failure, end script (e.g. IIS isn't available)
\r
124 Set WebObj = GetObject("IIS://LocalHost/W3SVC")
\r
127 'Remove all trailing backslashes to normalize
\r
128 do while (mid(InstallDir,Len(InstallDir),1) = "\")
\r
129 InstallDir = mid(InstallDir,1,Len(InstallDir)-1)
\r
131 ShibISAPIPath = InstallDir & "\lib\shibboleth\isapi_shib.dll"
\r
133 'Delete ISAPI Filter
\r
134 'First do the master service
\r
135 DeleteISAPIFilters "IIS://LocalHost/W3SVC",ShibISAPIPath
\r
136 'Now do the websites
\r
137 for each site in WebObj
\r
138 if (site.Class = "IIsWebServer") then
\r
139 sitePath = "IIS://LocalHost/W3SVC/" & site.Name
\r
140 DeleteISAPIFilters sitePath,ShibISAPIPath
\r
144 'Delete File Extensions
\r
145 'First do the master service
\r
146 DeleteFileExtensions WebObj,ShibISAPIPath
\r
147 'Now do the websites
\r
148 for each site in WebObj
\r
149 if (site.Class = "IIsWebServer") then
\r
150 set siteObj = GetObject("IIS://LocalHost/W3SVC/" & site.Name & "/ROOT")
\r
151 DeleteFileExtensions siteObj,ShibISAPIPath
\r
155 'Delete Web Services Extension (universal, no need to do for each site)
\r
156 WebObj.DeleteExtensionFileRecord ShibISAPIPath
\r
157 ' Got the IIS Object
\r
159 ' Sense whether this is an upgrade
\r