bat file to install .net 3.5 framework for win server 2012

how to install net framework 3.5 on windows 10 without cd
how to install net framework 3.5 on windows 10 offline mode
net framework 3.5 windows 10 offline
powershell install net 3.5 windows 10
install net framework 3.5 windows server 2016 without cd
install net framework 4.5 from command prompt
net framework 3.5 installation error
dism /online /enable-feature /featurename:netfx3 /all

I want to make a bat file to install .net Framework 3.5 on Windows Server 2012. I tried like this but with no success:

cd /D %userprofile% 
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 
Import-Module ServerManager 
powershell -ImportSystemModules Add-WindowsFeature NET-Framework-Features

Seems that after entering powershell console last 2 commands are not executed.

Does anyone have an idea why is getting stuck?

Or does anyone have other bat file how to automate install of .net 3.5 in windows server 2012?

After more trying i made the bat working with the following command when is run manually.

call C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ImportSystemModules Add-WindowsFeature NET-Framework-Features

But when i try run it from dotnetInstaller same bat is not working anymore

 <component command="CMD.EXE /K &quot;#APPPATH\Install.net3.5.bat&quot;" command_silent="" command_basic="" uninstall_command="" uninstall_command_silent="" uninstall_command_basic="" returncodes_success="" returncodes_reboot="" disable_wow64_fs_redirection="False" id=".Net 3.5 SP1 Win8Server" display_name=".Net 3.5 SP1" uninstall_display_name="" os_filter="" os_filter_min="winServer2008R2" os_filter_max="" os_filter_lcid="" type="cmd" installcompletemessage="" uninstallcompletemessage="" mustreboot="False" reboot_required="" must_reboot_required="False" failed_exec_command_continue="" allow_continue_on_error="True" default_continue_on_error="False" required_install="True" required_uninstall="True" selected_install="True" selected_uninstall="True" note="" processor_architecture_filter="" status_installed="" status_notinstalled="" supports_install="True" supports_uninstall="False" show_progress_dialog="True" show_cab_dialog="True">
 <installedcheck path="SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" fieldname="Install" fieldvalue="1" defaultvalue="False" fieldtype="REG_DWORD" comparison="match" rootkey="HKEY_LOCAL_MACHINE" wowoption="NONE" type="check_registry_value" description="Installed Check" />
      <installedcheck path="SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" fieldname="SP" fieldvalue="1" defaultvalue="False" fieldtype="REG_DWORD" comparison="match" rootkey="HKEY_LOCAL_MACHINE" wowoption="NONE" type="check_registry_value" description="Installed Check" />
    </component>  

I get this error Any idea why?

The term 'Add-WindowsFeature' is not recognized as the name of a cmdlet, functi on, script file, or operable program. Check the spelling of the name, or if a p ath was included, verify that the path is correct and try again. At line:1 char:19 + Add-WindowsFeature <<<< -name net-framework-features + CategoryInfo : ObjectNotFound: (Add-WindowsFeature:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException


Two options:

1) Use a script file and the File parameter.

#############
## script.ps1
Import-Module ServerManager
Add-WindowsFeature NET-Framework-Features

Then execute:

powershell -File c:\script.ps1

2) Use the Command parameter:

powershell -Command "Import-Module ServerManager; Add-WindowsFeature NET-Framework-Features"

In any case, try to avoid the -ImportSystemModules switch (deprecated in v3), it's just an overkill. It will load all system modules when all you need is just the ServerManager module. And if you are working in v3, the Import-Module command is redundant as well. See the module autp-loading feature.

Deploy .NET Framework 3.5 by using Deployment Image Servicing , NET Framework 3.5 feature files from Windows Update, use the following For Windows Server 2012 systems, feature installation state can be  echo Insert DVD orUSB flash drive andrun thisfile once again. echo. pause. Download the file, extract to your Desktop, right click run it as administrator. The file will install .NET Framework 3.5 automatically after finding the drive letter of your Windows Server 2012 R2 installation media. Batch file download. Enjoy.


I made it work with this bat:

call C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ImportSystemModules Add-WindowsFeature NET-Framework-Features

And in dotnetInstaller bootstrapper:

<component command="Install.net3.5.bat" command_silent="" command_basic="" uninstall_command="" uninstall_command_silent="" uninstall_command_basic="" returncodes_success="" returncodes_reboot="" disable_wow64_fs_redirection="True" id=".Net 3.5 SP1 Win8Server" display_name=".Net 3.5 SP1" uninstall_display_name="" os_filter="" os_filter_min="winServer2008R2" os_filter_max="" os_filter_lcid="" type="cmd" installcompletemessage="" uninstallcompletemessage="" mustreboot="False" reboot_required="" must_reboot_required="False" failed_exec_command_continue="" allow_continue_on_error="True" default_continue_on_error="False" required_install="True" required_uninstall="True" selected_install="True" selected_uninstall="True" note="" processor_architecture_filter="" status_installed="" status_notinstalled="" supports_install="True" supports_uninstall="False" show_progress_dialog="True" show_cab_dialog="True">
 <installedcheck path="SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" fieldname="Install" fieldvalue="1" defaultvalue="False" fieldtype="REG_DWORD" comparison="match" rootkey="HKEY_LOCAL_MACHINE" wowoption="NONE" type="check_registry_value" description="Installed Check" />
      <installedcheck path="SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" fieldname="SP" fieldvalue="1" defaultvalue="False" fieldtype="REG_DWORD" comparison="match" rootkey="HKEY_LOCAL_MACHINE" wowoption="NONE" type="check_registry_value" description="Installed Check" />
    </component>  

Seems that it didn't work before because the bootstrapper was starting the bat process as 32 bits which PS didn't like. So i put disable_wow64_fs_redirection="True" now it runs the bat as 64 bits process and it works :)

Thank you all for reply. I posted the answer maybe will help someone else :)

Enable .NET Framework 3.5 by using Windows PowerShell , For a Windows Server installation that is not connected to the Internet, you can use Windows PowerShell to add .NET Framework 3.5 and provide access to the \​sources\sxs folder on The \sources\sxs folder can be copied to network share (​for example, Windows Server 2012 or Windows Server 2016. In Windows Server 2012 R2, the.Net Framework 3.5 feature is an on-demand feature that its files are not saved on the server with the windows installation due to decreasing the disk space taken by the Operating System. Install .NET Framework 3.5 Features on Windows Server 2012 R2 (Offline)


This works the following way:

cd /D %userprofile% 
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "Import-Module ServerManager; ImportSystemModules Add-WindowsFeature NET-Framework-Features"
pause

How to install .NET Framework 3.5 (Automated batch file, Windows , NET Framework 3.5 binary files are not a part of the local cache of the binary files that are saved on the server's system disk when the operating  To enable .NET 3.5 SP1 on a Windows 8.x or 10 operating system, perform the following steps below: Open Control Panel, Program and Features (or Control Panel, Uninstall a program depending on your view setting). Click Turn Windows features on or off. In the window that appears, check . NET Framework 3.5 (includes .NET 2.0 and 3.0).


To run commands with powershell use the -Command parameter, like so:

powershell.exe -command "&{Import-Module ServerManager; ImportSystemModules Add-WindowsFeature NET-Framework-Features}"

How to Install .NET Framework 3.5 on Windows Server 2012 R2 , NET Framework 3.5 feature installed on Windows Server 2012 is: 'dism' is not recognized as an internal or external command, operable program or batch file. Then, select the local server you want to install the .NET 3.5 Framework onto and click the "Next" button. Select the "Server roles" page; do not select any role and just click on the "Next" button. After that, select the "Features" screen and check .NET Framework 3.5 features and click "Next".


Go to a command prompt and enter this:

dism /online /enable-feature /featurename:NetFX3 /all /Source:d:\sources\sxs /LimitAccess

Note: Source should be the Windows 2012 installation disc. In my case, this was located on D:

How To Install .NET Framework 3.5 using Powershell, DISM, and More, Here is a little gift for you guys, if you think that this process is too complicated, well go ahead and download the following Batch file that will save  Install .NET Framework 3.5 using the Server Manager. Go down to Specify an alternate source path and enter this in the path: <media drive>\sourcessxs Enter the source path. This should be the Windows media path. Install .NET Framework 3.5 using the offline installer


.NET Framework 3.5 Offline installation on Windows Server 2012/R2, NET Framework 3.5 feature is not installed by default on Windows Server 2012 R2 as In the Server Selection section, select your server, in my example below, my server is Running this script yields the following results:. To install the .net 3.5 on server 2012 without the disk (or disk image): Ensure that the server is NOT looking at a WSUS server for updates (must be looking at Windows Update for this to work) Ensure that any proxy/firewall will allow the connection from the server in question to the Windows update service


Install .NET Framework 3.5 feature on Windows Server 2012 R2 , Best Practices for Installing, Configuring, and Maintaining SharePoint Server a Windows Server 2012 R2 Standard Core install, first installing SQL Server via the NET 3.5 Framework dependency that cannot be loaded under future versions of the . via an .ini file, while the installation is processed through a batch file. However, it can run side by side with the .NET Framework 3.5 Service Pack 1 (SP1) and earlier versions of the .NET Framework. When you install this package, it is listed as Update for Microsoft Windows (KB4486081) under the Installed Updates item in Control Panel. Microsoft .NET Framework 4.8 is available on Windows Update and on Windows Server


Deploying SharePoint 2016: Best Practices for Installing, , NET framework 3.5 installed in Windows 10. From there, you can download a handy batch file which automates the task and does everything