Seite 1 von 1

Installation mit Lokalem Admin

Verfasst: 22 Mär 2011, 10:41
von schochc
Guten Tag zusammen,

Ich habe folgendes Problem. seit dem Update auf opsi 4.0 funktionieren die Installationen mit lokal angemeldetem Admin nicht mehr.

einige stunden und versuche später meldet sich der lokale Admin an und winst wird gestartet. nicht aber das script -> siehe Bild
winst.png
hier die setup.ins

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.

[Initial]
LogLevel=2
ExitOnError=false
ScriptErrorMessages=on
TraceMode=off

[Actions]
DefVar $ProductName$
Set $ProductName$ = ".NetFramework"
DefVar $ProductSizeMB$
Set $ProductSizeMB$ = "400"
DefVar $LocalSetupScript$
Set $LocalSetupScript$ = "local_dotnetfx.ins"
DefVar $LockKeyboard$
; set $LockKeyboard$ to "true" to prevent user hacks while admin is logged in
Set $LockKeyboard$="false"
; Set PasswdLogLevel to -2 to prevent passwords to logged (not working yet)

DefVar $PasswdLogLevel$
Set $PasswdLogLevel$="-2"
DefVar $OpsiAdminPass$
DefStringlist $outlist$

; some variables for the sub sections
DefVar $SYSTEMROOT$
DefVar $SYSTEMDRIVE$
DefVar $ScriptPath$
DefVar $ProgramFilesDir$
DefVar $HOST$
DefVar $AppDataDir$
Set $SYSTEMDRIVE$ = "%SYSTEMDRIVE%"
Set $SYSTEMROOT$ = "%SYSTEMROOT%"
set $ScriptPath$="%ScriptPath%"
set $ProgramFilesDir$="%ProgramFilesDir%"
set $Host$="%Host%"
set $AppDataDir$="%AppDataDir%"
; temp is always useful
DefVar $TEMP$
Set $TEMP$= EnvVar("TEMP")
DefVar $Tmp$
set $Tmp$ = EnvVar("TMP")
;Variables for version of the operating system (OS)-Test
DefVar $OS$

DefVar $MinorOS$
set $OS$ = GetOS
set $MinorOS$ = GetNTVersion

DefVar $RebootFlag$
DefVar $WinstRegKey$
DefVar $RebootRegVar$
DefVar $AutoName$
DefVar $AutoPass$
DefVar $AutoDom$
DefVar $AutoLogon$
DefVar $AutoBackupKey$
DefVar $LocalFilesPath$
DefVar $LocalWinst$

Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $RebootFlag$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag")
Set $AutoBackupKey$ = $WinstRegKey$+"\AutoLogonBackup"
Set $LocalFilesPath$ = "C:\tmp\opsi_local_inst_dotnet"
Set $LocalWinst$ = "c:\opsi\utils\winst32.exe"

if not ( FileExists ($LocalWinst$) )
Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
endif


if ($OS$ = "Windows_NT")
	if not (($RebootFlag$ = "1") or ($RebootFlag$ = "2"))
	;=========================
	; Anweisungen vor Reboot


		if not(HasMinimumSpace ("%SYSTEMDRIVE%", ""+$ProductSizeMB$+" MB"))
			LogError "Nicht genügend Platz auf C: . "+$ProductSizeMB$+" MB auf C: für "+$ProductName$+" erforderlich."
			else

			; zeige das Produktbild
			ShowBitmap /3 "%scriptpath%\localsetup\"+$ProductName$+".bmp" "$ProductName$"

			Message "Preparing "+$ProductName$+" install ..."
			sub_Prepare_AutoLogon

			; es muss reboot werden – sei sicher, dass das Autologon arbeitet

			; Reboot initialisieren ...

			Set $RebootFlag$ = "1"
			Registry_SaveRebootFlag
			ExitWindows /ImmediateReboot

		endif ; genuegend platz
	endif ; Rebootflag = not (1 or 2)
	if ($RebootFlag$ = "1")
		;=========================
		; Anweisungen nach Reboot
		; Rebootflag weitersetzen
		Set $RebootFlag$ = "2"

		Registry_SaveRebootFlag
		; die eigentlichen Anweisungen

		Message "Preparing "+$ProductName$+" install ..."
		Registry_enable_keyboard
		ExitWindows /ImmediateLogout
		; now let the autologon work
		; it will stop with a reboot
	endif ; Rebootflag = 1
	if ($RebootFlag$ = "2")
		;=========================
		; Anweisungen nach dem zweiten Reboot
		Set $RebootFlag$ = "0"
		Registry_SaveRebootFlag
		; dieses Abschnitt sollte hier verbleiben, auch wenn nichts zu tun ist
		; eventuell ist etwas „aufzuräumen“
		Message "Cleanup "+$ProductName$+" install ..."
		sub_Restore_AutoLogon
		; Das ist das Ende der Installation
	endif ; Rebootflag = 2
else
	LogError "Wir brauchen Windows 2000/XP fuer die Installation mit einem temporaeren lokalen User"

endif


[sub_Prepare_AutoLogon]
; kopieren des Setup Skripts und Dateien
Files_copy_Setup_files_local
; Lesen des aktuellen Autologon Wertes für die Sicherung
set $AutoName$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon]DefaultUserName")
; wenn der AutoLogonName ist unser SetupAdminUser, ist etwas nicht richtig gelaufen
; dann lass uns aufräumen

if ($AutoName$="opsiSetupAdmin")
	set $AutoName$=""
	set $AutoPass$=""
	set $AutoDom$=""
	set $AutoLogon$="0"
else

	set $AutoPass$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon]DefaultPassword")
	set $AutoDom$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon]DefaultDomainName")
	set $AutoLogon$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon]AutoAdminLogon")
endif

; Sichern der AutoLogon Werte
Registry_save_autologon
; Bereite den Admin AutoLogon vor
;LogLevel="$PasswdLogLevel$"
LogLevel=-2

;set $OpsiAdminPass$= RandomStr
Registry_autologon
; Erstellen unseres SetupAdminUsers
; DosInAnIcon_makeadmin
LogLevel=2
; Entfernen von c:\tmp\winst.bat mit Passwort

Files_remove_winst_bat
; speichern des Setup Skriptes als run once
Registry_runOnce
; blockieren von Keyboard und Maus während der Autologin Admin arbeitet
if ($LockKeyboard$="true")
	Registry_disable_keyboard
endif

[sub_Restore_AutoLogon]
; auslesen der AutoLogon Werte aus dem Backup
set $AutoName$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultUserName")
set $AutoPass$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultPassword")
set $AutoDom$= GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultDomainName")
set $AutoLogon$= GetRegistryStringValue("["+$AutoBackupKey$+"]AutoAdminLogon")
; wiederherstellen der Werte
;LogLevel="$PasswdLogLevel$"
LogLevel=-2
Registry_restore_autologon
LogLevel=2
; löschen des Setup Admin User
; DosInAnIcon_deleteadmin
; aufräumen des Setup Skriptes, Dateien und Profile
Files_delete_Setup_files_local
; Löschen der Profildirectory
DosInAnIcon_deleteprofile

[Registry_save_autologon]
openkey [$AutoBackupKey$]
set "DefaultUserName"="$AutoName$"
set "DefaultPassword"="$AutoPass$"
set "DefaultDomainName"="$AutoDom$"
set "AutoAdminLogon"="$AutoLogon$"

[Registry_restore_autologon]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"="$AutoName$"
set "DefaultPassword"="$AutoPass$"
set "DefaultDomainName"="$AutoDom$"
set "AutoAdminLogon"="$AutoLogon$"

; [DosInAnIcon_deleteadmin]
; NET USER opsiSetupAdmin /DELETE

[Registry_SaveRebootFlag]
openKey [$WinstRegKey$]
set "RebootFlag" = "$RebootFlag$"

[Files_copy_Setup_files_local]
copy -s %ScriptPath%\localsetup\*.* $LocalFilesPath$

[Files_delete_Setup_files_local]
delete -sf $LocalFilesPath$
; folgender Befehl funktioniert nicht vollständig, deshalb ist er zur Zeitauskommentier
; der Befehl wird durch die Sektion "DosInAnIcon_deleteprofile" ersetzt (P.Ohler)
;delete -sf "%ProfileDir%\opsiSetupAdmin"

; [DosInAnIcon_deleteprofile]
; rmdir /S /Q "%ProfileDir%\opsiSetupAdmin"

; [DosInAnIcon_makeadmin]
; NET USER opsiSetupAdmin $OpsiAdminPass$ /ADD
; NET LOCALGROUP Administratoren /ADD opsiSetupAdmin

[Registry_autologon]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"="%PCNAME%\Administrator"
set "DefaultPassword"="meinAdministratorPasswort:-)"
set "DefaultDomainName"="%PCNAME%"
set "AutoAdminLogon"="1"

[Registry_runonce]
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
set "opsi_autologon_setup"="$LocalWinst$ $LocalFilesPath$\$LocalSetupScript$"

[Registry_disable_keyboard]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass]
; disable
set "Start"=REG_DWORD:0x4
;enable
;set "Start"=REG_DWORD:0x1
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass]
; disable
set "Start"=REG_DWORD:0x4
;enable
;set "Start"=REG_DWORD:0x1
[Registry_enable_keyboard]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass]
; disable
;set "Start"=REG_DWORD:0x4
;enable
set "Start"=REG_DWORD:0x1
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass]
; disable
;set "Start"=REG_DWORD:0x4
;enable
set "Start"=REG_DWORD:0x1

[Files_remove_winst_bat]
delete -f c:\tmp\_winst.bat
und auch noch die localsetup.ins

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/

[Initial]
requiredWinstVersion >= "4.8.6"
LogLevel=2
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
[Aktionen]
DefVar $TEMP$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $NewExe$
DefVar $InstallDir$
DefVar $ExitCode$

Set $ProductId$ = "dotnetfx"
Set $MinimumSpace$ = "300 MB"
Set $InstallDir$ = "%ProgramFilesDir%\" + $ProductId$
Set $NewExe$ = $InstallDir$ + "\" +$ProductId$ + ".exe"

Set $TEMP$ = EnvVar("TEMP")

Registry_del_autologin

Message "Installing .NET Framework ..."

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 /3 "%scriptpath%\" + $ProductId$ + ".png" ".NET Framework"

	;if FileExists("%ScriptPath%\delsub.ins")
		;comment  "start uninstall sub section"
		;sub "%ScriptPath%\delsub.ins"
	;endif
	
	Message "Installiere .NET Framework ..."
	
	Message "Hallo jetz wird installiert......."
	Winbatch_install_netfx35
	Winbatch_install_netfx40
	sub_check_exitcode
	
	comment "test for installation success"
	if (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}] DisplayName") = "")
		logError "Fatal: After Installation [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}] not found"
	;	isFatalError
	endif
ExitWindows /ImmediateReboot
endif

[Registry_del_autologin]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"=""
set "DefaultPassword"=""

[Winbatch_install_netfx11]
"%ScriptPath%\dotnetfx.exe" /q:a /c:"install.exe /noaspupgrade /q"

[Winbatch_install_netfx35sp1]
; always use /lang:ENU otherwise the setup will download language packs from the internet
"%SCRIPTPATH%\dotnetfx35.exe" /lang:DEU /q /norestart

[Winbatch_install_netfx35_language_pack_de]
"%SCRIPTPATH%\dotnetfx35langpack_x86de.exe" /q /norestart

;[Winbatch_install_clwireg]
;"%ScriptPath%\files\Tools\clwireg.exe" /q
;
[Winbatch_install_RGB9RAST]
msiexec /i "%SCRIPTPATH%\RGB9RAST_x86.msi" /qb! ALLUSER=2 REBOOT=ReallySuppress
;
;[Winbatch_install_msxml6]
;msiexec /i "%SCRIPTPATH%\files\dotNetFX30\x86\msxml6.msi"   /qb! ALLUSER=2 REBOOT=ReallySuppress
;
;[Winbatch_install_netfx20a]
;msiexec /i "%SCRIPTPATH%\files\dotNetFX20\netfx20a_x86.msi" /qb! ALLUSER=2 REBOOT=ReallySuppress ADDEPLOY=1
;
;[Winbatch_install_netfx30a]
;msiexec /i "%SCRIPTPATH%\files\dotNetFX30\netfx30a_x86.msi" /qb! ALLUSER=2 REBOOT=ReallySuppress ADDEPLOY=1
;
;[Winbatch_install_net35]
;msiexec /i "%SCRIPTPATH%\files\dotNetFX35\x86\vs_setup.msi" /l*v "c:\tmp\dotnetfx35log.txt" /qb! ALLUSER=2 REBOOT=ReallySuppress VSEXTUI=1

[Winbatch_install_netfx35]
"%SCRIPTPATH%\dotnetfx35.exe" /q /norestart

[Winbatch_install_netfx40]
"%SCRIPTPATH%\dotNetFx40_Full_x86_x64.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

hat jemand eine Idee... oder sieht den Fehler??

Besten Dank schon mal

Re: Installation mit Lokalem Admin

Verfasst: 22 Mär 2011, 15:44
von d.oertel
Hi,

auf diese Problem wurde in den Upgradehinweisen verwiesen: Der pfad zum opsi-winst hat sich geändert

statt:

Code: Alles auswählen

Set $LocalWinst$ = "c:\opsi\utils\winst32.exe"

if not ( FileExists ($LocalWinst$) )
Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
endif
nun

Code: Alles auswählen

Set $LocalWinst$ = "c:\opsi\utils\winst32.exe"
if not( FileExists($LocalWinst$) )
	Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\preloginloader\utils\winst32.exe"
endif
if not( FileExists($LocalWinst$) )
	Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\preloginloader\opsi-winst\winst32.exe"
endif
if not( FileExists($LocalWinst$) )
	Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
endif
if not( FileExists($LocalWinst$) )
	LogError "No opsi-winst found. Abborting."
	isFatalError
endif
Ein upgrade auf das aktueller Rahmenscript aus dem Produkt opsi-template-with-admin ist sicherlich sinnvoll.

gruss
d.oertel

Re: Installation mit Lokalem Admin

Verfasst: 23 Mär 2011, 11:38
von schochc
Hallo,

ich habe das so geändert, es funktioniert aber leider noch nicht. genau gleich wie oben auf dem Bild wird winst gestartet.

ich habe das Script aus dem aktuellen winst Handbuch -> Revisionsstand 16.12.10

ist das nicht das aktuelle Script? wenn nicht könnten Sie den Link posten damit ich das richtige habe?

Re: Installation mit Lokalem Admin

Verfasst: 23 Mär 2011, 12:46
von d.oertel
Hi,

im Handbuch steht, das man das aktuellste aus dem Produkt opsi-template-with-admin nehmen soll:
http://download.uib.de/opsi4.0/products ... 1.0-5.opsi

gruss
d.oertel

Re: Installation mit Lokalem Admin

Verfasst: 23 Mär 2011, 14:15
von schochc
Hallo,

Das hat funktioniert....

Besten Dank :)