I'm looking to enable TCP/IP for SQL Server via CMD.exe using WMIC. I use a CustomAction to set the WixQuietExecCmdLine and another to execute. The command I use is:
WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement14 PATH ServerNetworkProtocol WHERE "ProtocolName='Tcp'" CALL SetEnable
The customaction runs immediately at a certain point in my installer. The installer also requires to be run in Admin mode so permission shouldn't be a problem.
I've set the text ComputerManagement14
to ComputerManagement[SQLVERSION]
where SQLVERSION
equals the first number in the MSSQLSERVER Version key in RegEdit (example: 14.0.0.0 => 14). That works properly so it's not the problem. I also run this command in CMD and it works. However, when I run the installer, I get the following error:
WixQuietExec: ERROR:
WixQuietExec:
Description = The system cannot find the file specified.
WixQuietExec:
WixQuietExec: Error 0x80070002: Command line returned an error.
WixQuietExec: Error 0x80070002: QuietExec Failed
WixQuietExec: Error 0x80070002: Failed in ExecCommon method
Here are the custom actions: `
<CustomAction Id="SetOpenTcpSql"
Property="WixQuietExecCmdLine"
Value='"cmd.exe" /c "WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement[SQLVERSION] PATH ServerNetworkProtocol WHERE "ProtocolName='Tcp'" CALL SetEnable"'/>
and
<CustomAction Id="CMDOpenTCPExec"
BinaryKey="WixCA"
DllEntry="WixQuietExec"
Execute="immediate"
Return="check"
Impersonate="no" />
I've tried changing WMIC
to C:\Windows\System32\wbem\wmic.exe
to no avail.
Any ideas?
Edit: Here is a snippet of the log file:
MSI (s) (48:6C) [14:54:53:213]: Doing action: SetOpenTcpSql
Action 14:54:53: SetOpenTcpSql.
Action start 14:54:53: SetOpenTcpSql.
MSI (s) (48:6C) [14:54:53:215]: PROPERTY CHANGE: Adding WixQuietExecCmdLine property. Its value is '"cmd.exe" /c "WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement14 PATH ServerNetworkProtocol WHERE "ProtocolName='Tcp'" CALL SetEnable"'.
Action ended 14:54:53: SetOpenTcpSql. Return value 1.
MSI (s) (48:6C) [14:54:53:215]: Doing action: CMDOpenTCPExec
Action 14:54:53: CMDOpenTCPExec.
Action start 14:54:53: CMDOpenTCPExec.
MSI (s) (48:28) [14:54:53:221]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI51AC.tmp, Entrypoint: WixQuietExec
MSI (s) (48!04) [14:54:53:232]: PROPERTY CHANGE: Deleting WixQuietExecCmdLine property. Its current value is '"cmd.exe" /c "WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement14 PATH ServerNetworkProtocol WHERE "ProtocolName='Tcp'" CALL SetEnable"'.
WixQuietExec: ERROR:
WixQuietExec:
Description = The system cannot find the file specified.
WixQuietExec:
WixQuietExec: Error 0x80070002: Command line returned an error.
WixQuietExec: Error 0x80070002: QuietExec Failed
WixQuietExec: Error 0x80070002: Failed in ExecCommon method
CustomAction CMDOpenTCPExec returned actual error code 1603 but will be translated to success due to continue marking
Action ended 14:54:53: CMDOpenTCPExec. Return value 1.
Note that it says it continues because I use Return="ignore"
instead of Return="check"
for the CustomAction.
Edit 2: By the way, I've also tried executing normally:
<CustomAction Id="CMDOpenTCPExec" Directory="INSTALLFOLDER" Execute="immediate" Impersonate="no" ExeCommand="[SystemFolder]cmd.exe /c "WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement[SQLVERSION] PATH ServerNetworkProtocol WHERE "ProtocolName='Tcp'" CALL SetEnable" />
User contributions licensed under CC BY-SA 3.0