DotNet 3.5 per OPSI installieren - Opsi-Template funktioniert bei mir nicht?

Antworten
IvicaE
Beiträge: 136
Registriert: 13 Sep 2016, 14:10

DotNet 3.5 per OPSI installieren - Opsi-Template funktioniert bei mir nicht?

Beitrag von IvicaE »

Hallo Leute,

ich versuche gerade ein Paket für MS .NET Framework 3.5 zu erstellen.
Kurz gesucht und ach gleich fündig geworden bei den user-script_templates.

Ich habe ein neues Paket erstellt, ein Unterordner 'setup' erstellt, die 237 MB große Datei (dotnetfx35.exe) hineinkopiert,
aus den opsi-templates die setup3264-, delsub3264 und unsintall3264-opsiscript-Dateien kopiert und eingefügt.

Dann die Inhalte der user-script-template-INS-Dateien für DotNet 3.5 kopiert und in die jeweilige opsiscript-Dateien eingefügt (also das vorherige ersetzt). Nun per opsi-winst versucht zu installieren und bekomme nach kurzer Anlaufzeit ein Windows System-Fenster (Windows-Features) mit folgendem Inhalt:
Von einer App auf dem PC wird das folgende Windows-feature benötigt:

.NET Framework 3.5 (enthält .NET 2.0 und 3.0)
Dazu bekomme ich Auswahlmöglichkeiten.
1. 'Feature herunterladen und installieren'
2. 'Installation überspringen'

Natürlich auch noch das obligatorische 'Abbrechen'

Zu diesem Zeitpunkt enthält der ExitCode im Script den Code '1603'.

So, ich habe etwas gegoogelt danach und auch hier uralte Einträge gefunden. Aber keine Lösung dazu.
Ich habe das volle Paket von .NET 3.5 SP1 (~237 MB). Ich habe an den Scripten aus dem user-Template nichts verändert.
Die Windows-Meldung ist dazu noch sehr komisch -> ich will gerade .NET 3.5 installieren und der bringt mir das eine App .NET 3.5 benötigt wird (für die Installation?).

So, jetzt meine Frage:
wie habt ihr das gelöst? Es ist ja essentiell das DotNet verteilt werden kann weil viele Programme das voraussetzen. Daher wird es sicher eine Lösung geben nur ich komme irgendwie nicht darauf.

Ich gehe mal davon aus das die Dateiendungen in den OPSI-Scripen selber irrelevant sind? Ich habe ein das opsi-template mit der Dateiendung 'opsiscript' genommen und den Inhalt des user-templates mit der Dateiendung 'ins' hinein kopiert. Aber Dateiendungen dürften nur Schall und Rauch sein sofern man keine 'Programmassoziation' damit benötigt. Also dürfte es hier egal sein, richtig?

P.S.
Ich bin nun etwas weiter gekommen. Ich muss das per 'dism' lösen, würde aber gerne wissen wozu ich dann noch dieses user-template benötigen wollte?
Also konkret meine 1. Frage: brauche ich die 231 MB große Datei dann wenn ich über DISM /online /enable-feature /featurename:NetFx3 usw. DotNet installiere?
Ist das dann nur die DotNet3 (die CAB-Datei in \Windows\winsxs ist lediglich 70 MB groß)?

2. Frage:
kann ich aus einem Windows 10 Installationsmedium die betreffende Netfx3-Cab-Datei in das CLIENT_DATA-Verzeichnis kopieren um dann DISM aus dem opsi-script aufzurufen und des Source-PArameter auf die lokale Datei verweisen? Also auf %Source%Path\dotnetfx35.cab verweisen mit dem Source-Parameter von DISM?
IvicaE
Beiträge: 136
Registriert: 13 Sep 2016, 14:10

Re: DotNet 3.5 per OPSI installieren - Opsi-Template funktioniert bei mir nicht?

Beitrag von IvicaE »

So, nachdem ich die von mir o.g. Vorgehensweise manuell in der Commandbox ausprobiert habe, kann ich sagen bestätigen daß diese Vorgehensweise bei mir geklappt hat.

Der Befehl:

Code: Alles auswählen

dism.exe /online /enable-feature /FeatureName:NetFx3 /source:"C:\temp\setup" /LimitAccess
funktioniert einwandfrei in der cmd. Vorher natürlich die Datei 'microsoft-windows-netfx3-ondemand-package.cab' vom Win10 64 Pro Installations-USB-Stick (aus dem Ordner ´\sources\sxs') nach 'c:\temp' kopiert.

So, wenn ich nun diese CAB-Datei nach 'CLIENT_DATA\setup' kopiere und im setup-script den o.g. Befehl verwende (natürlich die Pfadangabe für "/source:" angepasst auf "%ScriptPath%\setup\", bekomme ich einen ExitCode 11.
Ich habe es einmal in der WinBatch-Funktion ausgeführt und einmal in der 'DosBatch'. In beiden Fällen bekomme ich den ExitCode 11.

Wieso? Was kann ich machen? Wo ist das Problem?

Hier die Log-Datei:

Code: Alles auswählen

[1] [Apr 06 15:37:38:563] --
[1] [Apr 06 15:37:38:563] --
[1] [Apr 06 15:37:38:564] c:\opsi.org\log\opsi-script-part-Ta95Bs97.log
[1] [Apr 06 15:37:38:567] opsi-script 4.11.6.2 started at 06.04.2017 13:51:36
[1] [Apr 06 15:37:38:567] opsi-script log file with encoding utf8
[1] [Apr 06 15:37:38:572] 
[1] [Apr 06 15:37:38:573] ============ Version 4.11.6.2 script "D:\dotnet35\CLIENT_DATA\setup3264.opsiscript"
[1] [Apr 06 15:37:38:573]              used script encoding: cp1252
[1] [Apr 06 15:37:38:574]              used system encoding: cp1252
[1] [Apr 06 15:37:38:575]              start: 2017-04-06  15:37:38 
[1] [Apr 06 15:37:38:576]              on client named    "PC-OPSITEST"
[1] [Apr 06 15:37:38:577]              loggedin user    "Administrator"
[1] [Apr 06 15:37:38:577]              opsi-script running as    "Administrator"
[1] [Apr 06 15:37:38:578]              opsi-script running with admin privileges
[1] [Apr 06 15:37:38:579]              opsi-script running in standard script mode
[1] [Apr 06 15:37:38:580] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Apr 06 15:37:38:581] system infos:
[1] [Apr 06 15:37:38:582] 34-64-A9-38-07-2E  -  PC hardware address
[1] [Apr 06 15:37:38:583] pc-opsitest.AMF.local  -  IP name 
[1] [Apr 06 15:37:38:584] 192.1.0.140  -  IP address
[1] [Apr 06 15:37:38:585] DEU  -  System default locale 
[6] [Apr 06 15:37:38:589] Registry key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion]  opened
[6] [Apr 06 15:37:38:590] Key closed
[1] [Apr 06 15:37:38:591] MS Windows 10.0 64 Bit, Release: 1607, Edition: PRODUCT_PROFESSIONAL
[1] [Apr 06 15:37:38:592] 
[6] [Apr 06 15:37:38:597] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Apr 06 15:37:38:598] Key closed
[6] [Apr 06 15:37:38:636] opsi-script has version  4.11.6.2, required is : >= 4.10.8.6
[5] [Apr 06 15:37:38:637] Set  $INST_SystemType$ = GetSystemType
[6] [Apr 06 15:37:38:639]   The value of the variable "$INST_SystemType$" is now: "64 Bit System"
[5] [Apr 06 15:37:38:640] Set  $INST_architecture$ = GetProductProperty("install_architecture","system specific")
[4] [Apr 06 15:37:38:641] Property not existing in GetProductProperty - using default
[6] [Apr 06 15:37:38:642]   The value of the variable "$INST_architecture$" is now: "system specific"
[5] [Apr 06 15:37:38:644] Set  $LogDir$ 		= "C:\tmp"
[6] [Apr 06 15:37:38:645]   The value of the variable "$LogDir$" is now: "C:\tmp"
[5] [Apr 06 15:37:38:647] Set  $ProductId$       	= "dotnet_framework_35"
[6] [Apr 06 15:37:38:650]   The value of the variable "$ProductId$" is now: "dotnet_framework_35"
[5] [Apr 06 15:37:38:652] Set  $MinimumSpace$    	= "400 MB"
[6] [Apr 06 15:37:38:654]   The value of the variable "$MinimumSpace$" is now: "400 MB"
[6] [Apr 06 15:37:38:655] If
[6] [Apr 06 15:37:38:659]     Free on Disk C:: 207.080.968.192 bytes  This is more than the required amount of 400.000.000 bytes
[5] [Apr 06 15:37:38:661]   HasMinimumSpace ("C:", $MinimumSpace$)   <<< result true
[5] [Apr 06 15:37:38:663]   not(HasMinimumSpace ("C:", $MinimumSpace$))   <<< result false
[6] [Apr 06 15:37:38:664] Then
[6] [Apr 06 15:37:38:666] Else
[5] [Apr 06 15:37:38:668]   comment: Show product picture
[6] [Apr 06 15:37:38:670]   If
[5] [Apr 06 15:37:38:672]       Starting query if file exist ...
[5] [Apr 06 15:37:38:776]       "D:\dotnet35\CLIENT_DATA\delsub3264.ins": 
[5] [Apr 06 15:37:38:781]     FileExists("D:\dotnet35\CLIENT_DATA\delsub3264.ins")   <<< result false
[6] [Apr 06 15:37:38:785]   Then
[6] [Apr 06 15:37:38:790]   EndIf
[5] [Apr 06 15:37:38:795]   comment: installing
[5] [Apr 06 15:37:38:798]   
[5] [Apr 06 15:37:38:800]   Execution of WinBatch_install
[6] [Apr 06 15:37:38:802]     Call "dism.exe /online /enable-feature /FeatureName:NetFx3 /source:"D:\dotnet35\CLIENT_DATA\setup" /LimitAccess"
[6] [Apr 06 15:37:38:803]        Waiting until the called process is finished
[6] [Apr 06 15:37:38:805]     Start process as invoker: Administrator
[6] [Apr 06 15:37:39:815]     ExitCode 11    Executed process "dism.exe /online /enable-feature /FeatureName:NetFx3 /source:"D:\dotnet35\CLIENT_DATA\setup" /LimitAccess"
[6] [Apr 06 15:37:39:817]   
[6] [Apr 06 15:37:39:818]   ~~~~~~~ Start Sub ~~~~~~~  Sub_check_exitcode
[5] [Apr 06 15:37:39:820]   comment: Test for installation success via exit code
[5] [Apr 06 15:37:39:821]   Set  $ExitCode$ = getLastExitCode
[6] [Apr 06 15:37:39:823]     The value of the variable "$ExitCode$" is now: "11"
[6] [Apr 06 15:37:39:824]   If
[5] [Apr 06 15:37:39:825]     $ExitCode$ = "0"   <<< result false
[5] [Apr 06 15:37:39:826]     ($ExitCode$ = "0")   <<< result false
[6] [Apr 06 15:37:39:828]   Then
[6] [Apr 06 15:37:39:831]   Else
[5] [Apr 06 15:37:39:834]     comment: Setup program gives a exitcode unequal zero: 11
[6] [Apr 06 15:37:39:835]     If
[5] [Apr 06 15:37:39:836]       $ExitCode$ = "1605"   <<< result false
[5] [Apr 06 15:37:39:837]       ($ExitCode$ = "1605")   <<< result false
[6] [Apr 06 15:37:39:838]     Then
[6] [Apr 06 15:37:39:843]     Else
[6] [Apr 06 15:37:39:845]       If
[5] [Apr 06 15:37:39:846]         $ExitCode$ = "1641"   <<< result false
[5] [Apr 06 15:37:39:848]         ($ExitCode$ = "1641")   <<< result false
[6] [Apr 06 15:37:39:849]       Then
[6] [Apr 06 15:37:39:850]       Else
[6] [Apr 06 15:37:39:851]         If
[5] [Apr 06 15:37:39:853]           $ExitCode$ = "3010"   <<< result false
[5] [Apr 06 15:37:39:854]           ($ExitCode$ = "3010")   <<< result false
[6] [Apr 06 15:37:39:855]         Then
[6] [Apr 06 15:37:39:857]         Else
[3] [Apr 06 15:37:39:860]           Error: Fatal: Setup program gives an unknown exitcode unequal zero: 11
[5] [Apr 06 15:37:39:861]           Error level set to fatal
[5] [Apr 06 15:37:39:863]           Process aborted
[6] [Apr 06 15:37:39:867]   
[6] [Apr 06 15:37:39:869]   ~~~~~~~ End Sub   ~~~~~~~  Sub_check_exitcode
[6] [Apr 06 15:37:39:870]   
[5] [Apr 06 15:37:39:871]   Process aborted
[1] [Apr 06 15:37:39:874] ___________________
[1] [Apr 06 15:37:39:875] script finished
[1] [Apr 06 15:37:39:876] 1 error
[1] [Apr 06 15:37:39:880] 1 warning
[1] [Apr 06 15:37:39:881] 
[1] [Apr 06 15:37:39:882] 

Und hier das Script selber:

Code: Alles auswählen



[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $ExitCode$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
Set $INST_SystemType$ = GetSystemType
Set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
Set $LogDir$ 		= "%SystemDrive%\tmp"
Set $ProductId$       	= "dotnet_framework_35"
Set $MinimumSpace$    	= "400 MB"
; ----------------------------------------------------------------
 
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
	if FileExists("%ScriptPath%\delsub3264.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub3264.ins"
	endif
 
	comment "installing"
	
	WinBatch_install
	Sub_check_exitcode	
	
[WinBatch_install]
dism.exe /online /enable-feature /FeatureName:NetFx3 /source:"%ScriptPath%\setup" /LimitAccess
	
[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

(Das Script stammt vom user-template '.net 3.5' welches ich aber gleert habe und im Script nun mit dem 'dcim' experimentiere)
IvicaE
Beiträge: 136
Registriert: 13 Sep 2016, 14:10

Re: DotNet 3.5 per OPSI installieren - Opsi-Template funktioniert bei mir nicht?

Beitrag von IvicaE »

Okey, das wird hier eine Ein-Mann-Show wie ich sehe...

Ich habe nun in einem alten Thread, welches ein ähnliches Problem behandelt, eine Lösung gefunden:

Code: Alles auswählen

	ExecWith_dism "%systemroot%\cmd64.exe" /C
	Sub_check_exitcode	
	
[ExecWith_dism]
	dism.exe /online /disable-feature /FeatureName:NetFx3 /source:"%ScriptPath%\setup" /LimitAccess

Also der Funktion mitgeben das es in der 64-Bit-Cmd ausführen soll...

Ob ich für die 32-Bit-Version noch anpassen werde muss ich mir noch überlegen weil 32-Bit Windows wir hier gar nicht mehr nutzen...

Dennoch eine Frage zu dem ganzen:
Wieso ist die CAB-Datei (aus dem Installationsmedium) für das NetFx35 nur 70 MB groß und die DotNetFx35.exe 237 MB?
Avira
Beiträge: 36
Registriert: 22 Mär 2017, 15:29

Re: DotNet 3.5 per OPSI installieren - Opsi-Template funktioniert bei mir nicht?

Beitrag von Avira »

Hab leider nicht genug Zeit.
Vorschlag -> WSUSOFFLINE auf Windows starten. DotNet herunterladen. Client ordner Packen und als Script ausführen.
Such mal nach "IT-Class WSUSOFFLINE OPSI"
Antworten