Check IIS Version Before Installing: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
m (Removed now-superfluous NoAbort label)
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|icebrrrg}}
|<small>Author: [[{{ns:2}}:icebrrrg|icebrrrg]] ([[{{ns:3}}:icebrrrg|talk]], [[{{ns:-1}}:Contributions/icebrrrg|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== 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.
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.
Line 17: Line 15:
;
;
; This is built off MSFT's required keys for IIS
; This is built off MSFT's required keys for IIS
; (info at ttp://tinyurl.com/thon)
; (info at http://nsis.sf.net/wiki)
; and the NSIS archive (http://tinyurl.com/thom)
; and the NSIS Wiki (http://nsis.sf.net/wiki).
Function CheckIISVersion
Function CheckIISVersion


Line 25: Line 23:
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\InetStp" "MinorVersion"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\InetStp" "MinorVersion"


IfErrors 0 NoAbort
IfErrors IISMajVerLT5 0
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
IntCmp $0 5 0 IISMajVerLT5 0
 
DetailPrint "Found Microsoft Internet Information Server v$0.$1"
NoAbort:
Goto ExitFunction
DetailPrint "Found Microsoft Internet Information Server v$0.$1"
Goto ExitFunction


IISMajVerLT5:
IISMajVerLT5:
Line 41: Line 36:
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
[[Category:Other Products Version Detection Functions]]

Latest revision as of 10:10, 20 November 2014

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 http://nsis.sf.net/wiki)
; and the NSIS Wiki (http://nsis.sf.net/wiki).
Function CheckIISVersion
 
	ClearErrors
	ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\InetStp" "MajorVersion"
	ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\InetStp" "MinorVersion"
 
	IfErrors IISMajVerLT5 0
 
	IntCmp $0 5 0 IISMajVerLT5 0
	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