PDA

View Full Version : How check port status in installshield



huankhung133
08-20-2014, 05:11 AM
I want check port status of system by use installscript. But I don't know how to do it.
Please, help me!
Thank you so much.

jnagendra
10-03-2016, 07:20 PM
Can anyone please guide us how to check the port & popup message if port is in use

rguggisberg
10-04-2016, 08:00 PM
What kind of ports? If you mean IIS ports you can use APPCMD in a Custom Action.

sdnelson
10-07-2016, 04:41 AM
prototype BOOL isPortAvailable(STRING);

function BOOL isPortAvailable(szPortNumber)
STRING svCommand, svParams;
STRING svLine;
BOOL isAvailable;
NUMBER nvFileHandle;
begin
isAvailable = TRUE;
svCommand = SystemFolder ^ "netstat.exe";
svParams = " -an | find \"" + szPortNumber + "\" > \"" + FOLDER_TEMP ^ "stdout.txt\"";
LaunchAppAndWait( svCommand, svParams, LAAW_OPTION_HIDDEN | WAIT);
OpenFileMode (FILE_MODE_NORMAL);
if(OpenFile (nvFileHandle, FOLDER_TEMP, "stdout.txt") < 0) then
MessageBox ("OpenFile failed to open " + FOLDER_TEMP ^ "stdout.txt", SEVERE);
abort;
endif;
while GetLine (nvFileHandle, svLine) = 0
if(svLine != "") then
isAvailable = FALSE;
endif;
endwhile;
CloseFile (nvFileHandle);
return isAvailable;
end;