How to enable logging for the ManagementClass installation method
I am using the below code to install MSI on a remote machine. The installation was successful, but I want to generate a log file for the installation steps. help me enable registration.
ManagementClass productClass = new ManagementClass(this.m_WorkingNamespace, new ManagementPath("Win32_Product"), new ObjectGetOptions());
try
{
object[] parameters = { msiFilePath, installOptions, allUsers };
UInt32 returnValue = (UInt32)productClass.InvokeMethod("Install", parameters);
if (returnValue > 0)
throw new Exception("Installation failed. error code = " + returnValue);
}
+3
source to share
1 answer
A typical msi call looks like this:
msiexec /i "yourmsi.msi" /l*v "C:\log\example.log"
as you can see, you can add your own log path using msi call. Make sure that the folder for the log exists and can be accessed during installation.
Explanation of paralogs
- / l - create log
- * - Log all information except options v and x
- v - Extended output
If you need more information on msiexec command lines, you can run msiexec
from the command line and a help window will be displayed.
0
source to share