Hello Friends, today I want to share a script which will help you in preventing multiple instances of an installer simultaneously. For this you need to declare below two prototypes in your setup.rul file. 

prototype Kernel32.CreateMutex(byval NUMBER, BOOL, STRING);
prototype Kernel32.ReleaseMutex(HWND);
Below I had used a function named 'CheckMultipleInstance' which will help in preventing multiple instances of an installshield installer to run at a time.
//***************************************************************************
//FUNCTION NAME : CheckMultipleInstance
//Purpose : To prevent multiple instances of setup to run at one time.
//***************************************************************************
function CheckMultipleInstance(hMSI)
STRING strMutex;
HWND hMutex;
NUMBER nError;
begin
strMutex = "MY_SETUPMUTEX" ;
hMutex = Kernel32.CreateMutex(NULL, TRUE, strMutex);
nError = Err.LastDllError();
if (hMutex != 0 && nError == 183) then
MessageBoxEx("Another instance of this setup is already
running","",SEVERE);
ReleaseMutex(hMutex);
if(MsiSetProperty(ISMSI_HANDLE,"ANOTHERINSTANCE","1") ==
ERROR_SUCCESS) then
SprintfMsiLog("CUSTOM LOG: %s","Version is not Valid.");
endif;
abort;
else
if(MsiSetProperty(ISMSI_HANDLE,"ANOTHERINSTANCE","0") ==
ERROR_SUCCESS) then
SprintfMsiLog("CUSTOM LOG: %s","Version is not Valid.");
endif;
endif;
end;
prototype Kernel32.CreateMutex(byval NUMBER, BOOL, STRING);
prototype Kernel32.ReleaseMutex(HWND);
Below I had used a function named 'CheckMultipleInstance' which will help in preventing multiple instances of an installshield installer to run at a time.
//***************************************************************************
//FUNCTION NAME : CheckMultipleInstance
//Purpose : To prevent multiple instances of setup to run at one time.
//***************************************************************************
function CheckMultipleInstance(hMSI)
STRING strMutex;
HWND hMutex;
NUMBER nError;
begin
strMutex = "MY_SETUPMUTEX" ;
hMutex = Kernel32.CreateMutex(NULL, TRUE, strMutex);
nError = Err.LastDllError();
if (hMutex != 0 && nError == 183) then
MessageBoxEx("Another instance of this setup is already
running","",SEVERE);
ReleaseMutex(hMutex);
if(MsiSetProperty(ISMSI_HANDLE,"ANOTHERINSTANCE","1") ==
ERROR_SUCCESS) then
SprintfMsiLog("CUSTOM LOG: %s","Version is not Valid.");
endif;
abort;
else
if(MsiSetProperty(ISMSI_HANDLE,"ANOTHERINSTANCE","0") ==
ERROR_SUCCESS) then
SprintfMsiLog("CUSTOM LOG: %s","Version is not Valid.");
endif;
endif;
end;