AlexW
AlexW

Reputation: 3399

.NET Framework installation only in case it is not installed

I downloaded the .NET offline installer from: http://go.microsoft.com/fwlink/?LinkId=852107

How can I make it install the .NET 4.7.1 only in case it wasn't previously installed? Cause when I run:

NDP471-KB4033342-x86-x64-AllOS-ENU.exe /passive

It tries to install it although I already have the .NET 4.7.1 installed on my computer. There's a help switch for the tool, but none of the commands seem to fit my needs:

---------------------------
Microsoft .NET Framework
---------------------------
Usage:      Setup [switches] 

        All switches are optional. 



/CEIPconsent - Optionally send anonymous feedback to improve the customer experience. 

/chainingpackage <name> - Optionally record the name of a package chaining this one. 

/createlayout <full path> - Download all files and associated resources to the specified location. Perform no other action.  * Disabled * 

/lcid - Set the display language to be used by this program, if possible. Example: /lcid 1031 

/log <file | folder> - Location of the log file. Default is the process temporary folder with a name based on the package. 

/msioptions - Specify options to be passed for .msi and .msp items. Example: /msioptions "PROPERTY1='Value'" 

/norestart - If the operation requires a reboot to complete, Setup should neither prompt nor cause a reboot. 

/passive - Shows progress bar advancing but requires no user interaction. 

/showfinalerror - Passive mode only: shows final page if the install is not successful. 

/showrmui - Passive mode only: shows restart manager dialog if files are in use. 

/pipe <name> - Optionally create a communication channel to allow a chaining package to get progress. 

/promptrestart - If the operation requires a reboot to complete, Setup should prompt, and trigger it if the user agrees. 

/q - Quiet mode, no user input required or output shown. 

/repair - Repair the payloads. 

/serialdownload - Force install operation to happen only after all the payload is downloaded. 

/uninstall - Uninstall the payloads. 

/parameterfolder <full path> - Specifies the path to the Setup’s configuration and data files. 

/NoSetupVersionCheck - Do not check ParameterInfo.xml for setup version conflicts. 

/uninstallpatch {patch code} - Removes update for all products the patch has been applied to. 

/? - Display this help.



Examples:



Silently install the package and create log file SP123.htm in the temp folder:  Setup /q /log %temp%\SP123.htm

Install with no user interaction unless reboot is needed to complete the operation: Setup /passive /promptrestart



Some command line switches are disabled for this package: createlayout

(c) Microsoft Corporation. All Rights Reserved.
---------------------------
OK   
---------------------------

Upvotes: 0

Views: 1535

Answers (1)

Compo
Compo

Reputation: 38654

Whilst this doesn't answer your question it may be of use to you or future readers.

It is an untested batch file intended to determine the installed versions of .Net Framework from reading the registry:

@Echo Off
SetLocal EnableDelayedExpansion
Set "rk=HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP"
Set/A "vi=ri=0"

For /F "Tokens=3*" %%A In ('Reg Query "%rk%" /F v /K') Do If "%%B"=="" (
    If Not "%%~xA"=="" (Set/A "vi+=1"
        For /F "Tokens=2*" %%C In (
            'Reg Query "%rk%\%%~nxA" /V Version 2^>Nul^|Find /V "\"'
        ) Do Set "_v!vi!=%%D"
    ) Else (Set/A "ri+=1"
        For /F "Tokens=2*" %%E In (
            'Reg Query "%rk%\%%~nxA\Full" /V Release 2^>Nul^|Find /V "\"'
        ) Do Set/A "_r!ri!=%%F"))
If %ri% Gtr 0 (Set/A "vi+=1"
    For /F "Tokens=2" %%A In ('FindStr/B "!_r%ri%!" "%~f0"'
    ) Do Set "_v%vi%=%%A") 

If %vi% Gtr 0 For /F "Tokens=1* Delims==" %%A In ('Set _v') Do Echo([%%B]

Timeout -1
GoTo :EOF

Rem Later Version Table - do not remove
378389 4.5
378675 4.5.1
378758 4.5.1
379893 4.5.2
393295 4.6
393297 4.6
394254 4.6.1
394271 4.6.1
394802 4.6.2
394806 4.6.2
460798 4.7
460805 4.7
461308 4.7.1
461310 4.7.1
461808 4.7.2
461814 4.7.2
528040 4.8
528049 4.8
528372 4.8

Future Release dWord values can be added to the bottom of the table following the same format: 'dWordValueSPACE.NETVersion'

Upvotes: 1

Related Questions