There will be situations where you will need to install applications silently without any human intervention. This is a pretty normal use case for System Administrators and they love to automate their tasks. In fact knowledge of this subject may be handy for any technology worker in various circumstances. In this article we will silently install FileZilla on to the computer. Before we proceed further, here are a few things to keep in mind:
- To install an application silently using the installer exe/package, you must use the Silent Switch for silent installation as described by the Vendor of the Software. For example Silent Switch for FileZilla is /S. It may vary for different applications.
- Whether the application will install silently depends on how the packaging of the installer exe was done by the Vendor. So keep in mind that not every application can be installed silently.
- You can use PowerShell cmdlets/ PowerShell Scripts/ Batch Scripts from within your C# application to achieve Silent Installation of applications. In this tutorials we will be using PowerShell cmdlet to achieve the same.
Scenario: In my case here I have the installer exes in "ApplicationRepository" folder in C drive as shown below.

We will only be installing FileZilla as of now but you can extend it for any number of applications as you wish.
Also let us make sure that FileZilla is not installed by looking at installed applications in Control Panel. As we can see below, FileZilla is not currently installed.

Now let us see the code which does the magic i.e. installs application silently.
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Management.Automation;
- namespace SilentInstallation
- {
- class Program
- {
- static void Main(string[] args)
- {
- ProcessFolder();
- }
- private static void ProcessFolder()
- {
- const string SOURCEFOLDERPATH = @ "C:\ApplicationRepository";
- if (Directory.Exists(SOURCEFOLDERPATH)) {
- Console.WriteLine("Directory exists at: {0}", SOURCEFOLDERPATH);
- if (Directory.GetFiles(SOURCEFOLDERPATH, "*.exe").Length > 0) {
- int count = Directory.GetFiles(SOURCEFOLDERPATH, "*.exe").Length;
- string[] files = Directory.GetFiles(SOURCEFOLDERPATH, "*.exe");
- foreach(var file in files) {
- var fileName = System.IO.Path.GetFileName(file);
- var fileNameWithPath = SOURCEFOLDERPATH + "\\" + fileName;
- Console.WriteLine("File Name: {0}", fileName);
- Console.WriteLine("File name with path : {0}", fileNameWithPath);
- //Deploy application
- Console.WriteLine("Wanna install {0} application on this VM?
- Press any key to contiune.
- ", fileName);
- Console.ReadKey(); DeployApplications(fileNameWithPath); Console.ReadLine();
- }
- }
- } else
- Console.WriteLine("Directory does not exist at: {0}", SOURCEFOLDERPATH);
- }
- public static void DeployApplications(string executableFilePath)
- {
- PowerShell powerShell = null;
- Console.WriteLine(" ");
- Console.WriteLine("Deploying application...");
- try {
- using(powerShell = PowerShell.Create())
- {
- //here “executableFilePath” need to use in place of “
- //'C:\\ApplicationRepository\\FileZilla_3.14.1_win64-setup.exe'”
- //but I am using the path directly in the script.
- powerShell.AddScript("$setup=Start-Process 'C:\\ApplicationRepository\\
- FileZilla_3 .14 .1 _win64 - setup.exe ' -ArgumentList ' / S ' -Wait -PassThru");
- Collection < PSObject > PSOutput = powerShell.Invoke(); foreach(PSObject outputItem in PSOutput) {
- if (outputItem != null)
- {
- Console.WriteLine(outputItem.BaseObject.GetType().FullName);
- Console.WriteLine(outputItem.BaseObject.ToString() + "\n");
- }
- }
- if (powerShell.Streams.Error.Count > 0)
- {
- string temp = powerShell.Streams.Error.First().ToString();
- Console.WriteLine("Error: {0}", temp);
- } else
- Console.WriteLine("Installation has completed successfully.");
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine("Error occured: {0}", ex.InnerException);
- //throw;
- } finally
- {
- if (powerShell != null)
- powerShell.Dispose();
- }
- }
- }
- }
Now let us see this code in action using the following screenshots:
Deploying/ Installing Application

Depending upon the User Control Settings, there may be a prompt to allow our App to install another app(i.e. FileZilla). If you don't want this pop up and want absolute silent installation, change your settings to Never Notify as shown below and again run the console App if required after changing the setting. (Please Note: This setting is not recommended and it's good to revert after the demo).

If everything goes well, the application will be installed successfully as shown below.

Now again go to the Control Panel and refresh the list of installed applications. Now you will be able to see FileZilla installed on your machine.

In the next version I will try to write a WCF service that can run on a Windows Server and you can hit it with a POST request with relevant information to install an application when required. This concept can be used at many places especially in Server Maintenance and Application Installation.
You can download the above source code and screenshots by downloading the attached zip file.
Hope you enjoyed the article.
Thank You.
Read more articles on C# Programming:

Muhammad SheikhPosted Jul 24, 2023, 8:07 AM
I have the msi Package, can i also use this code for msi package ?
Ǻdñâň AbbẵŝPosted Apr 3, 2021, 10:35 AM
Dear i need your help.i have place installer file inside this program for silent installation. but when i create setup file and run that on another system its not installing that Installer. there must be issue with path because it changes system to system. also please help me i need to create Exe file and installer file will also be in that exe. for example i want to install avast silently so that avast installer will be part of exe. but i am unable todo it help me out
marwan khafagyPosted Jul 19, 2019, 5:44 PM
I need your help i want to make Silent installer with c# win forms
Ahmad MustafaPosted Aug 11, 2017, 3:20 AM
In my case it is not working not installing silently ? i am installing screen capturer recoder ? any solution for it ?
SubashPosted Aug 22, 2016, 10:40 PM
Nice
Humayun Kabir MamunPosted Apr 17, 2016, 2:25 AM
Nice...
Vignesh ManiPosted Apr 14, 2016, 8:14 AM
Good
Vineet KumarPosted Apr 13, 2016, 10:04 PM
There is another way by recording the inputs given on user interface while installing a package. It just records the input provided in a file. Now user can ship this input file and perform silent installation by command line. All the input parameters will be picked from this recorded file.
Mohammed IbrahimPosted Apr 13, 2016, 1:18 PM
nice info
Gowtham KPosted Apr 13, 2016, 12:28 PM
Good one, Thanks for sharing:)
Bhavik PatelPosted Apr 13, 2016, 5:55 AM
useful
Saurabh RaiPosted Apr 13, 2016, 4:01 AM
Thanks all :)
Nitesh KejriwalPosted Apr 13, 2016, 3:16 AM
Didn't knew about that before.. A good one!!!
Rahul ChavanPosted Apr 13, 2016, 2:43 AM
Good article
Gowtham RajamanickamPosted Apr 13, 2016, 2:22 AM
nice share