Although this is a very common task for IT administrators or developers, there are still relatively few documents on "remote installation of an msi package or exe application" that can be found online. Some people even wrote in some forum comments that this is impossible. In fact, it is still possible. I will provide two pieces of code in this article, which are responsible for remotely installing the MSI package and the EXE executable application.
1. Install the MSI package
Using PowerShell to call the WMI object, you can execute the following script to install your MSI installation package:
$product= [WMICLASS]"\\$box\ROOT\CIMV2:win32_Product"
Write-Host "Installing software on $box"
$("c:\Setup \")
It is quite good to install silently, so you no longer have to worry about using command parameters.
Note: Some installation packages may require users to select or set many options during the installation process, which is another matter.
2. Install the EXE application
What’s so annoying is that using the above method, you cannot successfully install the exe executable program installation package. If you have children’s shoes, can you leave a message to share your ideas or code? Because I’m also curious whether this is feasible. However, we can use another method to install the exe.
([WMICLASS]"\\$box\ROOT\CIMV2:win32_process").Create(
" /c c:\Setup\ /s /v`” /qn")
The above script actually creates a new process on the remote machine. First call it, pass the executable installation package in the form of parameters, and then passes the parameters required by the installer. This involves a lot of string escapes and quotation marks conversion, so be extra careful.
Source of the article:/