These scripts are designed to install and uninstall .NET Framework 3.5 on Windows machines. They can read parameters from the command line, a configuration file (config.json), or use default values. If any required parameter is missing and cannot be resolved, the scripts will fail with an appropriate error message.
This repository is licensed under the GNU General Public License v3.0 (GPLv3).
Created by Tommy Vange Rød. You can see the full list of credits here.
The contents of the SXS folders inside the source folder belong to Microsoft Corporation, who is the copyright and rights holder of these files. These files are necessary for the offline installation of .NET Framework 3.5 on Windows 10 and Windows 11 systems.
The scripts use a configuration file (config.json) to store default values for the .NET Framework 3.5 settings.
{ "Online": false, "Offline": false, "Logging": false }- [Optional]
Online: Use only online installation. - [Optional]
Offline: Use only offline installation. - [Optional]
Logging: Enables transcript logging if set. - [Optional]
SxsPath: Specifies a custom path to the SXS folder.
If a parameter is not provided via the command line, the script will attempt to read it from the config.json file. If the parameter is still not available, the script will try offline installation first and then online if offline fails.
The script automatically detects the Windows version using (Get-WmiObject Win32_OperatingSystem).Caption and sets the SxsPath accordingly:
- For Windows 10, it uses
source\w10\sxs. - For Windows 11, it uses
source\w11\sxs.
If the OS version is unsupported, the script will skip offline installation and proceed with online installation unless the -Offline parameter is specified, in which case it will fail.
The install script installs .NET Framework 3.5 using the specified parameters.
.\install.ps1 [-Online] [-Offline] [-Logging] [-SxsPath <PathToSxsFolder>]- Default installation (no logging, try offline first with fallback to online):
.\install.ps1- Online installation:
.\install.ps1 -Online- Offline installation with custom SXS path:
.\install.ps1 -Offline -SxsPath "C:\Path\To\SXS"- Enable logging:
.\install.ps1 -LoggingThe uninstall script removes .NET Framework 3.5 using the specified parameters.
To run the uninstall script, use the following command:
.\uninstall.ps1 [-Logging] - [Optional]
Logging: Enables transcript logging if set.
- Default uninstallation (no logging):
.\uninstall.ps1- Enable logging:
.\uninstall.ps1 -LoggingThe check script verifies if .NET Framework 3.5 is installed and outputs "Detected" or "NotDetected". It uses exit codes compatible with Intune: 0 for success (detected) and 1 for failure (not detected).
To run the check script, use the following command:
.\check.ps1The check.ps1 script does not accept any parameters.
- Check if .NET Framework 3.5 is installed:
.\check.ps1The install and uninstall scripts support transcript logging to capture detailed information about the script execution. Logging can be enabled via the -Logging parameter or the configuration file.
When logging is enabled, the scripts will start a PowerShell transcript at the beginning of the execution and stop it at the end. This transcript will include all commands executed and their output, providing a detailed log of the script's actions.
Logging can be enabled by setting the -Logging parameter when running the script, or by setting the Logging property to true in the config.json file.
The log files are stored in the temporary directory of the user running the script. The log file names follow the pattern:
- For the install script:
installation_log_NetFx3.txt - For the uninstall script:
uninstallation_log_NetFx3.txt - For the check script:
check_log_NetFx3.txt
Example log file paths:
C:\Users\<Username>\AppData\Local\Temp\installation_log_NetFx3.txtC:\Users\<Username>\AppData\Local\Temp\uninstallation_log_NetFx3.txtC:\Users\<Username>\AppData\Local\Temp\check_log_NetFx3.txt
System Account Exception: When scripts are run as the System account, such as during automated deployments or via certain administrative tools, the log files will be stored in the C:\Windows\Temp directory instead of the user's local temporary directory.
To enable logging via the command line:
.\install.ps1 -Logging.\uninstall.ps1 -LoggingOr by setting the Logging property in the configuration file:
{ "Online": false, "Offline": false, "Logging": true }All scripts include error handling to provide clear messages when parameters are missing or actions fail. If any required parameter is missing and cannot be resolved, the scripts will fail with an appropriate error message.
install.ps1: The script for installing .NET Framework 3.5.uninstall.ps1: The script for uninstalling .NET Framework 3.5.check.ps1: The script for checking installation status of .NET Framework 3.5.config.json: Configuration file for default values.source\w10\sxs: CAB files for Windows 10.source\w11\sxs: CAB files for Windows 11.
- Ensure you have the correct .CAB file(s) in the SXS for your Windows version in the respective
source\w10\sxsorsource\w11\sxsfolders. You can also specify your own location for the SXS folder.
You can get the CAB files by doing the following:
- Mount your Windows ISO.
- Browse to
\sources\sxs. - Find the file(s) containing netfx3 in the filename.
- Copy these files to a directory and point to it via the
-SxsPathparameter.
If you encounter any issues, ensure that all parameters are correctly specified and that the printer driver is available at the provided path. Check the error messages provided by the scripts for further details on what might have gone wrong.
| Tommy Vange Rød |
You can find more of my work on my GitHub profile or connect with me on LinkedIn.
Huge thanks to everyone who dedicates their valuable time to improving, perfecting, and supporting this project!
The GNU General Public License v3.0 (GPLv3) is a free, copyleft license for software and other creative works. It ensures your freedom to share, modify, and distribute all versions of a program, keeping it free software for everyone.
Full license can be read here or at gnu.org.
-
Freedom to Share and Change:
- You can distribute copies of GPLv3-licensed software.
- Access the source code.
- Modify the software.
- Create new free programs using parts of it.
-
Responsibilities:
- If you distribute GPLv3 software, pass on the same freedoms to recipients.
- Provide the source code.
- Make recipients aware of their rights.
-
No Warranty:
- No warranty for this free software.
- Developers protect your rights through copyright and this license.
-
Marking Modifications:
- Clearly mark modified versions to avoid attributing problems to previous authors.