cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
huankhung133
Level 2

How check port status in installshield

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.
Labels (1)
0 Kudos
(3) Replies
Not applicable

Can anyone please guide us how to check the port & popup message if port is in use
0 Kudos
rguggisberg
Level 13

What kind of ports? If you mean IIS ports you can use APPCMD in a Custom Action.
0 Kudos
sdnelson
Level 5

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;
0 Kudos