GRitchie Posted October 1, 2014 Posted October 1, 2014 Hello, Seems I post way too often here, anyway, does anyone have a full working example script of how to install .NET Framework 4.5 completely silently? Ideally I'd have it run with the MDT image, but it seems I may need to add it to my script. Cheers!
sted Posted October 1, 2014 Posted October 1, 2014 it does powershell 4 as well but this seems to work for me rem @echo OFF rem works bets as SHUTDOWN script as it requires config that happens at reboot rem check windows version for 7 VER | findstr /l "6.1." > nul IF %ERRORLEVEL% EQU 0 goto install goto exit :install REM Check to see if .Net Framework 4.5 is installed REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.2" IF %errorlevel%==1 GOTO INSTALLNET IF %errorlevel%==0 GOTO checkps4 :INSTALLNET "\\domain.local\dfs\packages\ms msi\dotnet452\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" /norestart /q :checkps4 rem check to see of powershell 4 is installed REG QUERY "HKLM\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" /f 4.0 IF %errorlevel%==1 GOTO INSTALLWMF IF %errorlevel%==0 GOTO EXIT :INSTALLWMF echo Detecting OS processor type if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT echo 32-bit OS wusa.exe "\\domain.local\dfs\packages\ms msi\powershell4\Windows6.1-KB2819745-x86-MultiPkg.msu" /quiet /norestart goto exit :64bit echo x64 os wusa.exe "\\domain.local\dfs\packages\ms msi\powershell4\Windows6.1-KB2819745-x64-MultiPkg.msu" /quiet /norestart :EXIT rem shutdown /r Exit
GRitchie Posted October 1, 2014 Author Posted October 1, 2014 it does powershell 4 as well but this seems to work for me rem @[u][url="http://www.edugeek.net/member.php?u=16971"]echo[/url][/u] OFF rem works bets as SHUTDOWN script as it requires config that happens at reboot rem check windows version for 7 VER | findstr /l "6.1." > nul IF %ERRORLEVEL% EQU 0 goto install goto exit :install REM Check to see if .Net Framework 4.5 is installed REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.2" IF %errorlevel%==1 GOTO INSTALLNET IF %errorlevel%==0 GOTO checkps4 :INSTALLNET "\\domain.local\dfs\packages\ms msi\dotnet452\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" /norestart /q :checkps4 rem check to see of powershell 4 is installed REG QUERY "HKLM\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" /f 4.0 IF %errorlevel%==1 GOTO INSTALLWMF IF %errorlevel%==0 GOTO EXIT :INSTALLWMF echo Detecting OS processor type if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT echo 32-bit OS wusa.exe "\\domain.local\dfs\packages\ms msi\powershell4\Windows6.1-KB2819745-x86-MultiPkg.msu" /quiet /norestart goto exit :64bit echo x64 os wusa.exe "\\domain.local\dfs\packages\ms msi\powershell4\Windows6.1-KB2819745-x64-MultiPkg.msu" /quiet /norestart :EXIT rem shutdown /r Exit Wow, I don't know powershell, but that looks like a very scary script... Could you point out where I'd need to change things? I notice it says 64bit, much to my upset, we're still on 32bit over here!
sted Posted October 1, 2014 Posted October 1, 2014 Wow, I don't know powershell, but that looks like a very scary script... Could you point out where I'd need to change things? I notice it says 64bit, much to my upset, we're still on 32bit over here! it works on x64 or x86 thats why its there and that bits just for adding powershell the exe to use depends on x86/x64 so it check and then runs the correct one. Tyhe script is in batch i just use it to deploy powershell 4 to pcs and powershell 4 needs dotnet 4.x so i have it install/check that first. All you need to edit is the file paths so change \\domain.local\dfs\packages\ms msi\dotnet452\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" to the location of your dotnet install file. if you dont need powershell you can delete everything from rem check to see of powershell 4 is installed just leave :exit and down
GRitchie Posted October 2, 2014 Author Posted October 2, 2014 Anyone else have any ideas? I would go with yours @sted if I had some sort of powershell knowledge, but I have 0! I notice you should be able to put [path]\donetfour.exe /passive /norestart /showfinalerror into MDT But that extracted the installer and then basically crashed it for me?
sted Posted October 2, 2014 Posted October 2, 2014 Anyone else have any ideas? I would go with yours @sted if I had some sort of powershell knowledge, but I have 0! I notice you should be able to put [path]\donetfour.exe /passive /norestart /showfinalerror into MDT But that extracted the installer and then basically crashed it for me? you don't need powershwell knowledge its a batch script that installs powershell4 as well as dotnet just throw that bit out if you don't need it then it has 0 to do with powershell its just something I wanted on pcs and it needs dotnet4.x so I just did it as one script if you just want dotnet then rem @echo OFF rem works bets as SHUTDOWN script as it requires config that happens at reboot rem check windows version for 7 VER | findstr /l "6.1." > nul IF %ERRORLEVEL% EQU 0 goto install goto exit :install REM Check to see if .Net Framework 4.5 is installed REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.2" IF %errorlevel%==1 GOTO INSTALLNET IF %errorlevel%==0 GOTO checkps4 :INSTALLNET "\\domain.local\dfs\packages\ms msi\dotnet452\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" /norestart /q :EXIT rem shutdown /r Exit is all you need I just copied it all as it was simpler
GRitchie Posted October 2, 2014 Author Posted October 2, 2014 you don't need powershwell knowledge its a batch script that installs powershell4 as well as dotnet just throw that bit out if you don't need it then it has 0 to do with powershell its just something I wanted on pcs and it needs dotnet4.x so I just did it as one script if you just want dotnet then rem @[u][url="http://www.edugeek.net/member.php?u=16971"]echo[/url][/u] OFF rem works bets as SHUTDOWN script as it requires config that happens at reboot rem check windows version for 7 VER | findstr /l "6.1." > nul IF %ERRORLEVEL% EQU 0 goto install goto exit :install REM Check to see if .Net Framework 4.5 is installed REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.2" IF %errorlevel%==1 GOTO INSTALLNET IF %errorlevel%==0 GOTO checkps4 :INSTALLNET "\\domain.local\dfs\packages\ms msi\dotnet452\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" /norestart /q :EXIT rem shutdown /r Exit is all you need I just copied it all as it was simpler Ohh okay! I'll try that Is that passive or silent? As in, does it display a progress bar?
sted Posted October 2, 2014 Posted October 2, 2014 Ohh okay! I'll try that Is that passive or silent? As in, does it display a progress bar? I run it as a logoff script so it displays absolutely nothing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now