Check IIS Version Before Installing: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Reverted edits by 222.65.202.53 to last version by ConversionBot) |
|||
Line 9: | Line 9: | ||
</highlight-nsis> | </highlight-nsis> | ||
== The Function == | |||
<highlight-nsis> | |||
;-------------------------------- | |||
; CheckIISVersion Function | |||
; | |||
; This is built off MSFT's required keys for IIS | |||
; (info at ttp://tinyurl.com/thon) | |||
; and the NSIS archive (http://tinyurl.com/thom) | |||
Function CheckIISVersion | |||
ClearErrors | |||
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\InetStp" "MajorVersion" | |||
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\InetStp" "MinorVersion" | |||
IfErrors 0 NoAbort | |||
Abort "Setup could not detect Microsoft Internet Information Server v5 or later; this is required for installation. Setup will abort." | |||
IntCmp $0 5 NoAbort IISMajVerLT5 NoAbort | |||
NoAbort: | |||
DetailPrint "Found Microsoft Internet Information Server v$0.$1" | |||
Goto ExitFunction | |||
IISMajVerLT5: | |||
Abort "Setup could not detect Microsoft Internet Information Server v5 or later; this is required for installation. Setup will abort." | |||
ExitFunction: | |||
[[ | |||
FunctionEnd | |||
</highlight-nsis> | |||
[[Category:Other Products Version Detection Functions]] |
Revision as of 19:33, 26 July 2005
Author: icebrrrg (talk, contrib) |
Description
Here's a quick function that will check the registry to see (1) if IIS is installed, and (2) the version is at least v5.0. You can manipulate it to check for other versions. I call this in a section which installs the web virtual directory, so we only check for IIS if that module is selected by the user.
Function Call
Call CheckIISVersion
The Function
;-------------------------------- ; CheckIISVersion Function ; ; This is built off MSFT's required keys for IIS ; (info at ttp://tinyurl.com/thon) ; and the NSIS archive (http://tinyurl.com/thom) Function CheckIISVersion ClearErrors ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\InetStp" "MajorVersion" ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\InetStp" "MinorVersion" IfErrors 0 NoAbort Abort "Setup could not detect Microsoft Internet Information Server v5 or later; this is required for installation. Setup will abort." IntCmp $0 5 NoAbort IISMajVerLT5 NoAbort NoAbort: DetailPrint "Found Microsoft Internet Information Server v$0.$1" Goto ExitFunction IISMajVerLT5: Abort "Setup could not detect Microsoft Internet Information Server v5 or later; this is required for installation. Setup will abort." ExitFunction: FunctionEnd