cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Awolf401
Level 4

Urgent help with installer UAC and x64

I have spent a good deal of time on this problem and have researched the forums but cannot come up with a solution. I have this installer working for everything but UAC enabled Vista and x64 vista. This is a basic msi installer and has a different installer for 32 and 64 bit. My 64 bit uses the x64 template and I have read and implemented "7 Reasons why your installations may fail one Windows vista" by Stefan Krueger. On both installers all of my install scripts are Deferred in System Context.

I will be the first to admit that I do not have a good grasp on Installshield logic but I am learning. Both problems involve adding a port exception to the windows firewall and I have included the code below. From what I can tell when the In-script execution is set to defered execution in system context MsiGetProperty returns nothing. But when it is set to execute immediatly the netsh command does not execut properly. Any help is greatly appricaiated and an explanation attached to help me learn would be awsome. Thank you for your help in advance and sorry for any typos but I have a deadlin for this in two days so grammer took a hit.:D


function configFirewall(hMSI)
string dataPort, cmd, args1, args2;
number size;

begin
size = 10;
MsiGetProperty(ISMSI_HANDLE, "IDDATAPORT", dataPort, size);
cmd = WINSYSDIR^"netsh.exe";
args1 = "firewall add portopening tcp " + dataPort + " portname enable All";
args2= "firewall set opmode enable enable";
MessageBox(args1, WARNING);
LaunchAppAndWait( cmd, args1, LAAW_OPTION_WAIT||LAAW_OPTION_HIDDEN);
LaunchAppAndWait( cmd, args2, LAAW_OPTION_WAIT||LAAW_OPTION_HIDDEN);
MessageBox(args1, WARNING);
//set registry entry
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
RegDBSetKeyValueEx ("Software\\Key name", "PortNumber" , REGDB_STRING , dataPort , -1 );
end;
Labels (1)
0 Kudos
(2) Replies
RobertDickau
Flexera Alumni

To get the values of properties in a deferred script or code (InstallScript, C DLL, VBScript, etc.), please search the help and these forums for "CustomActionData".

Having said that, I haven't tried it, but could you just launch netsh directly with a launch-EXE action, instead of going through InstallScript? You can pass properties as command-line arguments using the [PROP_NAME] syntax, and there's no need to use CustomActionData when the property is a command-line argument to a deferred executable action...
0 Kudos
Awolf401
Level 4

😮 Well I got it to work on 64 bit. Actually the problem didnt come from 64 bit it came from someone changing my test machine to Home Premium. This is why I can't use the exe. I am using a if else script to detect the type of os and then running the appropriate netsh syntax. It is different in vista and the only version of vista that will take the old way is business and ultimate. So just for reference

Old netsh
netsh firewall add portopening tcp 80 port opening enable all

new netsh

netsh advfirewall firewall add rulename="Port Name" dir=in action=allow protocol=TCP localport=80

Still though I cannot get the firewall port open if UAC is on. I have to Run as Administrator to get it to work properly and I Have looked at customAction and im not sure I understand it fully. I run a customaction that will transfer the property between the two sequences? Again thanks for all the help. And I hope my netsh discovery will help someone.

thanks
0 Kudos