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


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:

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.

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

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) [],
+ FullyQualifiedErrorId : CommandNotFoundException


I made it work with this bat:

And in dotnetInstaller bootstrapper:

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 🙂


bat file to install .net 3.5 framework for win server 2012 by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply