.NetFX 4.5.2

Versions
By Adlerweb 2015/01/27

Based on http://mercurial.giprecia.fr/opsi-packages/opsi-framework-net4

This script includes setup and uninstall for the german language pack. If you modify this script for other languages please add the corresponding IDs to the table shown at the end.

Tested with opsi 4.0.5

Setup Ressources

Required external files

copy to CLIENT_DATA.

setup.ins

[Actions]
requiredWinstVersion >= "4.11.3.4"
 
DefVar $SystemType$
DefVar $ProductId$  
DefVar $ProductName$
DefVar $ExitCode$
DefVar $MsiId$  
 
set $SystemType$ = GetSystemType
Set $ProductId$  = "dotnetfx45"
Set $ProductName$  = ".NET Framework 4.5.x"
 
Sub "%ScriptPath%\delsub.ins"
 
Message "Installing " + $ProductName$
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductName$
 
Message "Installing " + $ProductName$ + " Core Files"
winbatch_install_netfx
Sub_check_exitcode
 
Message "Installing " + $ProductName$ + " Update Files"
winbatch_install_netfx_sp
Sub_check_exitcode
 
Message "Installing " + $ProductName$ + " Language Pack"
winbatch_install_netfx_lang
Sub_check_exitcode
 
[winbatch_install_netfx]
%ScriptPath%\dotNetFx40_Full_x86_x64.exe /passive /norestart
 
[winbatch_install_netfx_sp]
%ScriptPath%\NDP452-KB2901907-x86-x64-AllOS-ENU.exe /passive /norestart
 
[winbatch_install_netfx_lang]
%ScriptPath%\NDP452-KB2901907-x86-x64-AllOS-DEU.exe /passive /norestart
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

uninstall.ins

[Actions]
 
DefVar $SystemType$
DefVar $ProductId$  
DefVar $ProductName$
DefVar $ExitCode$
DefVar $MsiId$
 
set $SystemType$ = GetSystemType
Set $ProductId$  = "dotnetfx45"
Set $ProductName$  = ".NET Framework 4.5.x"
 
Sub "%ScriptPath%\delsub.ins"

delsub.ins

Message "Removing " + $ProductName$
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductName$
 
 
if $SystemType$ = "x86 System"
	winbatch_Framework_dotnet45x_uninstall_32
	Files_uninstall_32
else
	; 4.5.2 German 64Bit
	Set $MsiId$ = "{1DB0C90B-2A9F-3A1E-B1DF-616C5A2A1417}"
	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi
		sub_check_exitcode
	endif
 
	; 4.5.2 64Bit
	Set $MsiId$ = "{26784146-6E05-3FF9-9335-786C7C0FB5BE}"
	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi
		sub_check_exitcode
	endif
	Set $MsiId$ = "{92FB6C44-E685-45AD-9B20-CADF4CABA132}"
	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi
		sub_check_exitcode
	endif
 
	; Microsoft .NET Framework 4 Extended
	Set $MsiId$ = "{8E34682C-8118-31F1-BC4C-98CD9675E1C2}"
	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi
		sub_check_exitcode
	endif
 
	; Microsoft .NET Framework 4 Client Profile
	Set $MsiId$ = "{F5B09CFD-F0B2-36AF-8DF4-1DF6B63FC7B4}"
	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi
		sub_check_exitcode
	endif
endif
 
Sub_check_exitcode
 
[winbatch_Framework_dotnet45x_uninstall_32]
;Untested
"%Systemroot%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe" /uninstall /x86 /x64 /ia64 /parameterfolder Extended /passive /norestart 
"%Systemroot%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client\setup.exe" /uninstall /x86 /x64 /parameterfolder Client /passive /norestart
 
[Files_uninstall_32]
delete -sf "%Systemroot%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\"
 
[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "3010")
			comment "looks good: setup program gives exitcode 3010"
			comment "ERROR_SUCCESS_REBOOT_INITIATED 3010    The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "1641")
				comment "looks good: setup program gives exitcode 1641"
				comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

Other Languages

Language Download MSI-ID
German NDP452-KB2901907-x86-x64-AllOS-DEU.exe 1DB0C90B-2A9F-3A1E-B1DF-616C5A2A1417

QR Code
QR Code userspace:netfx_4.5.2 (generated for current page)