How to programmatically run an msi file. Errors when installing programs from the Windows Installer ".msi" package

A fairly common problem among users of the Windows operating system of any version is the msi error when installing programs from a file with the .msi extension. In this article, I will describe common problems with the Windows 7/10/XP installer and solutions to them, and also make a video on the current issue.

Files with the .msi extension are regular installation packages (distributions) from which the program is installed. Unlike the usual “setup.exe”, the system uses the Windows Installer service (msiexec.exe process) to launch the msi file. Speaking in simple words, Windows Installer will unzip and run the files from the distribution. When Windows Installer does not work, various errors appear.

In general, this really infuriates me, because... After a stupid error message, it’s completely unclear what to do next. Microsoft specifically developed the Windows Installer to expand the capabilities of installing programs (mainly for system administrators), but did not take proper care to ensure that the service would run smoothly or even adequately report problems. Now we have to sort it out :)

Problems may be with the operation of the service itself or may arise during the installation of programs, when everything is configured, in principle, correctly. In the first case, you need to tinker with the installer service, and in the second, solve a problem with a specific file. Let's consider both options, but first the second one.

msi file errors

Very often errors appear due to insufficient system rights to files or folders. This is not to say that Windows Installer does not work; in this case, you just need to add the necessary rights and everything will work. Just yesterday I was faced with the fact that the downloaded distribution kit.msi did not want to be installed, the installation wizard starts successfully, the parameters are selected, but then the system thinks for a few seconds and gives an error:

"Error reading from file 'filename' verify that the file exists and that you can access it" (Error 1305). Translated: “Error reading from file...check if the file exists and if you have access to it.” Well, aren't you stupid? Naturally, the “Retry” button does not help, and canceling stops the entire installation. The message also does not carry any special meaning, because the file definitely exists and I have access to it, otherwise I simply wouldn’t be able to run it and receive this message, and for some reason it’s in English :)

And the mistake is that it is not I who should have access to the file, but the Windows installer, or rather the System itself. The solution is very simple:

Now the installer error will not appear! You can add access to the entire folder from which you usually install programs, for example, to the “Downloads” folder, like mine. Watch a video on solving problems with access rights:

In Windows XP, the Security tab will not appear if simple file sharing is enabled. To turn it off, you need to go to “Start -> Control Panel -> Folder Options -> View” and turn off the “Use simple file sharing” option. In stripped-down versions of Windows 7/10 and XP, there is no “Security” tab at all. To see it, you need to log in as an administrator.

More ways to solve the problem


The described method will help with different messages, with different numbers. For example, you may see msi file errors like this:

  • Error 1723
  • Internal Error 2203
  • System error 2147287035
  • Error: "This installation package cannot be opened"
  • Error 1603: A fatal error occurred during installation

In all these cases, setting permissions on the file and/or on some system folders should help. Check if the "system" has access to the temporary files folder (you may receive the error "The system cannot open the specified device or file"). To do this:

After pressing “Enter” the path will change to “normal” and you will be moved to the real temporary folder. The rights to it need to be checked. I also recommend clearing temporary folders of everything that has accumulated there, or even better, deleting them and creating new ones with the same names. If you can’t delete a folder, read, but it’s not necessary.

If the Windows Installer service still does not want to work, then check the rights to the folder "C:\Config.Msi", here the “system” must also have full access. In this case, you may have seen the error “Error 1310”. Just in case, make sure that the folder WHERE you are installing the software also has all rights.

Registry and service settings

The next way to resolve the error is to restore operating parameters in the Windows Installer registry.

To do this, download the archive and run two reg files from there, according to your Windows versions. Agree to import settings.

Important! It is advisable before the last action! If the method does not help or gets worse, you can recover to your previous state.

In Windows XP or Windows Server 2000 install the latest installer version 4.5.

If this does not help, then re-register the components:

  1. Press "Win + R" and enter " cmd". Then in the black window enter the following commands in sequence:
    MSIExec /unregister
    MSIExec /regserver
  2. The answer should be empty, no errors. If the problem is not solved, enter another command
    regsvr32 msi.dll
  3. Close the black window

If it says that you do not have enough rights, then you need to run .

If the commands were executed, but did not help, then run msi_error.bat from the archive and check the result.

The last option is to download the Kerish Doctor program, it has a function for fixing the installer service and many others common problems Windows.

Also, many programs use the .NET Framework, so it would be a good idea to install the latest version of this package. And, finally, one more piece of advice: if in the path to the distribution file there is at least one folder with a space at the beginning of the name, then remove the space. This simple trick will solve your problem :)

Summing up

Errors with the Windows installer are very unpleasant, there are a lot of them and it’s not immediately clear where to look. One thing is clear - the system has failed and needs to be restored to working condition. Sometimes nothing helps and you have to. However, do not rush to do this, try asking for help on this forum. Describe your problem exactly, tell us what you have already done, what messages you have received, and perhaps they will help you! After all, the world is not without good people :)

If you have installed on your computer antivirus program Can scan all files on your computer, as well as each file individually. You can scan any file by right-clicking on the file and selecting the appropriate option to scan the file for viruses.

For example, in this figure it is highlighted my-file.msi file, then you need to right-click on this file and select the option in the file menu "scan with AVG". When you select this option, AVG Antivirus will open and perform a scan this file for the presence of viruses.


Sometimes an error may occur as a result incorrect installation software , which may be due to a problem encountered during the installation process. This may interfere with your operating system associate your MSI file with the correct application software , influencing the so-called "file extension associations".

Sometimes simple reinstalling 7-Zip may solve your problem by linking MSI to 7-Zip correctly. In other cases, problems with file associations may result from bad software programming developer and you may need to contact the developer to obtain additional help.


Advice: Try updating 7-Zip to latest version to make sure you have the latest patches and updates installed.


This may seem too obvious, but often The MSI file itself may be causing the problem. If you received the file via an attachment email or downloaded it from a website and the download process was interrupted (for example, a power outage or other reason), the file may become damaged. If possible, try to get new copy MSI file and try to open it again.


Carefully: A damaged file may cause collateral damage to a previous or existing malware on your PC, so it is very important to keep an updated antivirus running on your computer at all times.


If your MSI file related to the hardware on your computer to open the file you may need update device drivers associated with this equipment.

This problem usually associated with media file types, which depend on successfully opening the hardware inside the computer, e.g. sound card or video cards. For example, if you are trying to open an audio file but cannot open it, you may need to update sound card drivers.


Advice: If when you try to open an MSI file you receive .SYS file error message, the problem could probably be associated with corrupted or outdated device drivers that need to be updated. This process can be made easier by using driver update software such as DriverDoc.


If the steps do not solve the problem and you are still having problems opening MSI files, this may be due to lack of available system resources. Some versions of MSI files may require a significant amount of resources (e.g. memory/RAM, processing power) to properly open on your computer. This problem is quite common if you are using fairly old computer hardware and at the same time a much newer operating system.

This problem can occur when the computer has difficulty completing a task because the operating system (and other services running in background) can consume too many resources to open MSI file. Try closing all applications on your PC before opening the Windows Installer Package. Freeing up all available resources on your computer will provide the best conditions for attempting to open the MSI file.


If you completed all the steps described above and your MSI file still won't open, you may need to run equipment update. In most cases, even when using older versions of hardware, the processing power can still be more than sufficient for most user applications (unless you're doing a lot of CPU-intensive work, such as 3D rendering, financial/scientific modeling, or intensive multimedia work) . Thus, it is likely that your computer does not have enough memory(more commonly called "RAM", or RAM) to perform the file open task.

Errors when installing applications from files with the .msi extension are one of the manifestations of operational problems Windows services Installer (in the Russian version - Windows installer). Users of all versions of this OS, with the exception of the earliest ones, encounter a similar phenomenon. Until now, the problem with the installer is one of the common reasons why users decide to reinstall the system. Let's try to figure out how to avoid this. The reason that Windows Installer does not work may be the following:

  • viral infection, and removing the virus does not always solve the problem;
  • incorrect installation Windows updates;
  • a malfunction of the security software when, instead of blocking one suspicious msi file, the installation service is blocked entirely;
  • changes in computer security policies;
  • damage system files or the registry for reasons not related to viruses (removal of installer components, unqualified editing of the registry, crooked software, malfunction hard drive etc.).

Checking the integrity of the Windows Installer structure

Windows Installer represented by the following components:
  • file C:\Windows\System32\Msiexec.exe - directly by the installer application itself;
  • file C:\Windows\System32\msi.dll - Windows Installer library;
  • Msiserver service, whose settings are stored in the registry key.
Before diagnosing, it is important to make sure that both of these files are present in the system, that the above section is in the registry and its parameters have normal values ​​(the values ​​can be viewed in the registry of a similar, working system). Also open the list of services (press Windows + R and enter the command services.msc in the "Open" line of the "Run" application). Find "Windows Installer" and make sure it starts. If the files are missing, copy them from another system of the same version or from the installation disk. If a registry key is missing or damaged, also move it from working system. To do this, on a working computer, run the registry editor (C:\Windows\Regedt.exe) and find the above section. Right-click the context menu of the msiserver folder and click "Export". Save the file in .reg format and transfer it to the problem machine. Double-click this file and agree to add data to the registry. Restart your computer. If the Msiserver service still does not start, check that the RPC (Remote Procedure Call) service on which it depends is running. You can re-register the installer files and restart the service using a set of special commands on the command line. For convenience, you can create a batch file: paste a set of actions into Notepad and save it as a .bat extension. To launch a file, simply double-click on it. For the changes to take effect, click on the desktop and press F5.

Checking security settings and access rights

Windows Installer may not work because it is blocked by security software or the operating system does not have the necessary rights. First, let's look at the software. If you have an antivirus installed, temporarily disable it. Each product has its own methods of disabling, but most often this is done through the context menu of the antivirus icon in the system tray. Now let's take care of the rights. Open the context menu of Msiexec.exe and expand its properties. View the list of groups and users on the Security tab. Among them must be “System” and the “Trustedinstaller” service, and the latter must have full access to the file and be its owner. The system must have "read" and "read and execute" permissions. The Trustedinstaller service first appeared in Windows Vista, so in Windows XP full access must be granted to the system. Everything written below applies to versions released later than XP. To check who owns Msiexec.exe, click the "Advanced" button on the same tab. In the next window, expand the "Owner" tab. Set the owner to the Trustedinstaller service if something else is specified as the owner. If it is not in the "Change owner to" list, click the "Change" button, and then click "Other users and groups." Enter Trustedinstaller in the "Enter names..." field, click "Check names" and OK. Return to the previous window. On the "Effective Permissions" tab, assign the necessary rights to Trustedinstaller and the system. The msi.dll library should have exactly the same security settings. Now let's check if there are any restrictions for the "System" user to access the following:
  • system drive (usually drive C);
  • temporary folders (these are C:\Windows\Temp and C:\Users\Current_User\AppData\Temp);
  • folder C:\Config.Msi;
  • the folder where the msi file from which you are trying to install the program is located.
The system must be given full access to all these objects. This is done in the same way as we discussed above. After these operations, in most cases the problem with the installer is successfully resolved. If our advice did not help you, the cause of the failure lies in something else and specialists should deal with it.

Some programs and drivers in Windows should only be installed with administrator rights. In the case of EXE files, the option to install as administrator is present in the context menu, which is called up by right-clicking on the file. There is no such option for MSI packages, but you can add it through the registry editor.

Instructions

Open the Run dialog via the start menu or by pressing the Win+R key combination. In the window that opens, write regedit and press Enter. The Registry Editor will launch. Depending on your User Account Control settings, you may be asked to confirm that you want to launch the editor.

Go to the HKEY_CLASSES_ROOT\Msi.Package\shell branch. Right-click on “shell” and in the menu that opens, select the option to create a new partition.

A subsection will be added to the “shell” section. Rename it "runas" (no quotes needed).

In the window on the right, double-click on the “Default” key or once with the right mouse button and select “Change...” In the empty value field, enter “Run as Administrator”. Confirm the changes by pressing the OK button.

Now right-click on “runas” and select the create partition option again. Create a subkey named "command" (without the quotes).

Edit the "Default" key by entering the command "msiexec /i "%1"" in the value field (without the herringbone quotes, but with quotes for %1). Click OK.

Introduction

Our installers for Windows contain a complete client side installation package (MSI) (built on the basis of Windows Installer v2.0). Instructions for network installation assumes that the user is familiar with the basics of Windows Installer, in particular with deploying MSI files. This package can be used with any operating system Windows supporting Windows Installer v2.0.

Installation on a network server

  1. Double click on the resulting file ( Yenka_Setup_(MSI).exe)
  2. Install this package into the folder public access to your programs.
  3. Attention : The program must be activated BEFORE deploying the package on the network. To do this, run "Yenka.exe" from the folder where you installed the program (<путь установки>\program files\Yenka\Software\Yenka.exe), and follow the Activation Instructions.

Installation

Installing an MSI package using the command line

  1. In the command field, enter the line:
    msiexec /i"<путь к MSI файлу>\YK.msi"
    Where:<путь к MSI файлу>this is the path to the Windows Installer package file. For example, the line might look like this: msiexec /i"C:\Program Files\Yenka\YK.msi"
  2. Press ENTER
    Attention: The Windows Installer service allows installation in “stealth” mode, using the “/q” switch. For example: msiexec /i"C:\Program Files\Yenka\YK.msi" /q. To show the installation progress indicator, you can use the key " /qb".

Uninstalling an MSI package using the command line

  1. From the Start menu, select "Run..."
  2. In the command field, enter the line:
    msiexec /x"<путь к MSI файлу>\YK.msi"
    Where:<путь к MSI файлу>this is the path to the Windows Installer package file
  3. Press ENTER