Reputation: 33
In the company I work we use Inno Setup to install our software products. The problem is that our software is only compatible with Windows Server versions. Like Windows Server 2008 and Windows Server 2012.
What I'm trying to do is show a message and prevent the user to install in a non server versions. Like Windows 8 and 7 for instance.
I searched and is possible to check the Windows version using the Windows build number. But the build number of server versions of Windows are the same of some desktop. Is possible to check it here: http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes
Is there any way to make an installer that installs only on server versions of Windows using Inno Setup?
Since now, thank you all.
Upvotes: 3
Views: 1320
Reputation: 202594
You can test TWindowsVersion.ProductType
returned by GetWindowsVersionEx
function from InitializeSetup
event.
[Code]
function InitializeSetup(): Boolean;
var
Version: TWindowsVersion;
begin
Result := True;
GetWindowsVersionEx(Version);
Log(Format('Product Type is %d', [Version.ProductType]));
if Version.ProductType = VER_NT_WORKSTATION then
begin
MsgBox('This product can be installed on Windows Server only.', mbError, MB_OK);
{ Abort installer }
Result := False;
end;
end;
I've been defensive and test for Version.ProductType = VER_NT_WORKSTATION
. Maybe you want to test Version.ProductType <> VER_NT_SERVER
or Version.ProductType <> VER_NT_SERVER and Version.ProductType <> VER_NT_DOMAIN_CONTROLLER
.
For more details, refer to documentation of wProductType
field of OSVERSIONINFOEX
structure.
See also What is the simplest way to differentiate between Windows versions?
Upvotes: 2