How to Silently Install Dot Net Framework 2.0 Using Batch File

When you develop an application using Microsoft Visual Studio, it always requires Microsoft .NET Framework to be installed on clients in order to run the application but the required version may be vary depends on applications. Even third-party software around the world today are sometimes require Microsoft .NET Framework so you should install .NET Framework on clients at the first time you prepare them. But generally, there are computers which actively using by users and don’t have .NET Framework. Therefore, you should find a solution to install .NET Framework on clients without interrupt them. There are many solutions to solve the problem. In this post, I show how to silently install .NET Framework 2.0 SP1 on a local computer. The minimum recommend version is 2.0 Service Pack 1. Currently, the most updated version is 3.5 Service Pack 1. Silently installation means that the software is installed in background so it doesn’t require any user interaction while it’s installing. It is a useful method for deploy software to clients without interrupt users.

First of all, you have to download .NET 2.0 SP1 from Microsoft. Then, I’ll show the command use to install in silent mode. After that, I create a batch file to run the command to make the installation easier.

Note: To install .NET Framework 2.0 SP1, it requires Windows Installer 3.1 to be installed first.

Step-by-step to silently install dot net framework 2.0 using batch file

  1. Download Microsoft .NET Framework 2.0 Service Pack 1 from Microsoft.
  2. On a client, open command prompt by Start -> Run -> type cmd -> press Enter.
    Open Command Prompt
  3. Use /q parameter to install .NET Framework 2.0 SP1 in silent mode. Type “C:\NetFx20SP1_x86.exe /q”.
    Note: The path to file of yours may not be the same as the example.
    Install Dot Net Framework 2.0 Silently
  4. You won’t notice any dialog or user input message. But you can check if there is any error on the installation in Application Event Log. This is the example of the successfully installation message.
    Product: Microsoft .NET Framework 2.0 Service Pack 1 – Update ‘.NET Framework CRT’ installed successfully.
    Note: There are also other messages in the event log about the installation. This is just one of them.
    Application Event Log
  5. You can also observe in Add or Remove Programs if .NET Framework has been installed or not. Click Start -> Settings -> Control Panel -> Add or Remove Programs.
    Add or Remove Programs
  6. Next, to make the installation more practical. I’ll move the installation file to a shared folder on \\192.168.125.12\MISC so you don’t need to copy the installation file to a target computer every time. Then, I create a batch file to execute the installation in silent mode so you don’t have to type the command every time.
    The batch file will look as similar as below:
    \\192.168.125.12\MISC\NetFx20SP1_x86.exe /q
    A Batch File
  7. Now I’ve tried to install the software by execute the batch file with a normal user credential. I have observed an error message below.
    Setup discover the following problem:
    You must have administrative privileges to run Microsoft.NET Framework 2.0 SP1 Setup. Please contact your system administrator.

    You must have administrative privileges to run Microsoft.NET Framework 2.0 SP1 Setup
  8. The error message stated clearly that the current user doesn’t has privilege to install a software. To solve the problem, I use “runas” command to execute the installation as a domain administrator (virtual\administrator). Modify the batch file to be as below.
    runas /user:virtual\administrator “\\192.168.125.12\MISC\NetFx20SP1_x86.exe /q”
    Note: You can view the command reference by follow the link at the bottom.
    Runas Command on Batch File
  9. Now try to run the batch file with a normal user credential again. It’ll ask for domain administrator’s password (the account which I’ve specified in the batch file). Type the password and press Enter.
    Note: The password won’t show on the screen.
    Type Password for Runas Command
  10. After a few minutes, observe the Application Event Log. You’ll see the message similar as the figure below.
    Product: Microsoft .NET Framework 2.0 Service Pack 1 — Installation completed successfully.
    Note: In user column, the user is virtual\administrator which isn’t the current user logon but it’s the user that I’ve specified in the batch file.
    Application Event Log

Reference

2 Comments

  1. SK July 24, 2009
  2. ACube November 21, 2009

Leave a Reply

%d bloggers like this: