427032cff2618fdf31f355cfcb0294a7ba0b7a4b
[shibboleth/cpp-sp.git] / msi / scripts / shib_upgrade_check.vbs
1 Dim WshShell, versionArray, versionElement, versionNumbers, regValue, foundVersionsStr
2 Set WshShell = CreateObject("WScript.Shell")
3
4 versionNumbers = Session.Property("OLDSHIBVERSIONSTOUNINSTALL")
5
6 versionArray = split( versionNumbers, ";" )
7
8 foundVersionsStr = ""
9
10 for each versionElement in versionArray
11   if (versionElement<>"") then
12
13     'if RegRead fails, it won't set regValue, and it will hold the last value instead.  Make sure the 'last' value is ""
14     regValue = ""
15     on error resume next
16       regValue=WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Shibboleth " & versionElement & "\UninstallString")
17     if (regValue<>"") then
18       foundVersionsStr = foundVersionsStr & "Shibboleth " & versionElement & vbCRLF
19     end if
20
21   end if
22 next
23
24 if (foundVersionsStr<>"") then
25   Session.Property("OLDSHIBVERSIONSFOUND") = foundVersionsStr
26 end if