Probleme mit Winst-Script auf W2K-Clients

Antworten
Benutzeravatar
Neptunium
Beiträge: 224
Registriert: 03 Jul 2008, 12:08
Wohnort: Marburg - Germany

Probleme mit Winst-Script auf W2K-Clients

Beitrag von Neptunium »

Hallo,

nun habe ich selber mal ein Problem, was mich schon einigen Stunden beschäftight und in den Wahnsinn treibt:

Ich habe die uiB-Vorlage für die Installation von .Net mit lokalem Admin genommen und das ein wenig abgeändert und aufgebohrt. U.a. habe ich dafür ein .NET Paket von Microsoft genommen, in dem .NET 2.0SP2, 3.0SP2 und 3.5SP1 inklusive aller Sprachpakete drin ist, sozusagen der ultimative .NET-Rundumschlag. Außerdem setze ich am Ende der Installation noch mit caspol.exe Rechte zur Ausführung eines .NET-Programms auf einem Netzlaufwerk. Das alles funktionierte bislang in meiner Test-VM und bei Testinstallationen auf 8 realen Clients einwandfrei. Gottseidank habe ich letzte Woche dann auch noch einen Test auf einem Windows2000 System gemacht, da unter den weit über 1000 Clients, die mit diesem Paket beglückt werden sollen, auch knapp 300 W2K-Systeme sind. Ich traute meinen Augen nicht, als das Paket, daß unter XP einwandfrei durchlief, gleich bei den ersten Kommandos Fehlermeldungen produzierte. Und zwar 2 verschiedene, die mir wirklich spanisch vorkommen: 1. kein zulässiger String-Ausdruck und 2. fehlerhafte Zeichen:
Beispiel für 1.:
greenshot_2009-11-02_18-28-42.png

Beispiel für 2.:
greenshot_2009-11-02_18-28-59.png
Es sind immer je ein String- und ein Zeichenfehler pro Zeile (Zeilen 99, 146, 150). Die OS-Abfrage soll eigentlich dazu dienen, unter W2K ein reines .NET 2.0 Paket und unter XP das große Installationspaket mit :NET 2.0, 3.0 und 3.5 zu installieren.
Momentan ist es aber z.B. nicht mal mehr möglich, unter W2K den freien Plattenplatz mit HasMinimumSpace auszulesen. Ich habe es gerade nochmal explizit getestet: Unter XP läuft alles einwandfrei durch und das gleiche Produkt vom gleichen Opsi-Server liefert die obigen Fehlermeldungen unter W2K.

Die Fehlermeldung bzgl fehlerhaftes Zeichen deutet ja eigentlich darauf hin, daß sich wirklich ein irreguläres Zeichen eingeschlichen hat. Ich kann aber mit meinen Editoren keines entdecken. Ich nutze nedit, mcedit, joe und vi als Editoren, je nachdem mit welchem Editor eine Sache schneller oder angenehmer zu erledigen ist.

Ich hoffe eigentlich, daß der Fehler bei mir liegt, denn dann läßt er sich sicherlich einfacher und schneller fixen. ;)

Gruß

Dirk

P.S.: Ich hänge mal meine Scripte hier an. Auf dem Server läuft Opsi 3.4 mit allen Updates:

Code: Alles auswählen

opsiserver:~# dpkg -l | grep opsi
ii  opsi-atftpd                                 0.7.dfsg-1.4     advanced TFTP server - opsi version with pcr
ii  opsi-configed                               1.4.05-2     OPSI config editor
ii  opsi-depotserver                            3.4-1     server fuer das Softwareverteilungssystem OP
ii  opsi-linux-bootimage                        20090911-1     Linux-Bootimage fuer das Softwareverteilungs
ii  opsi-utils                                  3.4-1     OPSI utils
ii  opsiconfd                                   2.0.0.19-3     OPSI configuration service
ii  opsipxeconfd                                0.3.8-1     OPSI PXE configuration daemon
ii  python-opsi                                 3.4.0.2-1     OPSI python library

Code: Alles auswählen

opsiserver:~# opsi-package-manager -l
------------------------------
- opsiserver.firma.tld -
------------------------------
   Product ID                Version
   ======================================
   dotnet35                  3.5-1
   opsi-winst                4.8.8.1-2
   preloginloader            3.4-31
   python                    2.5.2-8     
Das Haupt-Winstscript:
; Copyright (c) uib umwelt informatik buero gmbh (http://www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
;
; 22.10.2009
;
;
;

[Initial]
LogLevel=3
ExitOnError=true
ScriptErrorMessages=on
TraceMode=off

[Aktionen]
DefVar $ProductName$
Set $ProductName$ = "dotnet35"
DefVar $ProductSizeMB$
Set $ProductSizeMB$ = "750"
DefVar $LocalSetupScript$
Set $LocalSetupScript$ = "local_"+$ProductName$+".ins"
DefVar $LockKeyboard$
; set $LockKeyboard$ to "true" to prevent user hacks while admin is logged in
Set $LockKeyboard$="true"
; Set PasswdLogLevel to -2 to prevent passwords to logged included in opsi 2.5 / winst32.exe version 4.2.x !!!
;
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

if $OS$ = "Windows_NT"
Set $MinorOS$ = GetNTVersion
endif

if $MinorOS$ = "Win2k"
LogError "Windows2000 wird nicht von .NET 3.0 und 3.5 unterstuetzt => Installationsabbruch"
ExitOnError = true
isFatalError
; Bearbeitung beenden und Produktschalter auf failed setzen
else
if not ( $MinorOS$ = "WinXP" )
LogError "Dies ist erst recht keine unterstuetzte OS-Version: "+$MinorOS$
ExitOnError = true
isFatalError
endif
endif


DefVar $uncpath_1$
DefVar $uncpath_2$
DefVar $uncpfad_1$
DefVar $uncpfad_2$

DefVar $ExitCode$

; =========================================================================

DefVar $ProductId$
DefVar $ProductVer$
DefVar $MinimumSpace$
DefVar $CreatedBy$

; Produkt, -Version und Paketerstellungsinformationen:
set $ProductId$ = ".NET Framework"
set $ProductVer$ = "2.0SP2 & 3.0SP2 & 3.5 SP1"
set $CreatedBy$ = "Firma GmbH (10/2009)"
set $MinimumSpace$ = "750 MB"

; Message at install time:
Message "Installiere "+$ProductId$+" "+$ProductVer$+" ..."

if not(HasMinimumSpace ("%SYSTEMDRIVE%", $MinimumSpace$))
LogError "Not enough space on C: . "+$MinimumSpace$+" auf C: fuer "+$ProductId$+" erforderlich."
ExitOnError = true
isFatalError
; Bearbeitung beenden und Produktschalter auf failed setzen
else
ShowBitmap /2
ShowBitmap /3
; show product picture
if FileExists("%scriptpath%\firma.png")
ShowBitmap /2 "%scriptpath%\firma.png" $CreatedBy$
endif
endif

if FileExists("%scriptpath%\dotnet.png")
ShowBitmap /3 "%scriptpath%\dotnet.png" $ProductId$
endif

;DefVar $del-net$
;Set $del-net$ = IniVar("del-net")
;
;if ($del-net$="true")
; if FileExists("%ScriptPath%\sub.del")
; ; Aufruf der Deinstallationsroutine, um vorhandene Installationen
; ; vor einer Neuinstallation zu entfernen:
; sub "%ScriptPath%\sub.del"
; endif
;endif

; ==========================================================================

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"
Set $LocalWinst$ = "c:\opsi\utils\winst32.exe"
if not( FileExists($LocalWinst$) )
Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\preloginloader\utils\winst32.exe"
endif
; preloginloader >= 3.4
if not( FileExists($LocalWinst$) )
Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\preloginloader\opsi-winst\winst32.exe"
endif


if ($OS$ = "Windows_NT" AND not ($MinorOS$="NT4"))

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


if not(HasMinimumSpace ("%SYSTEMDRIVE%", ""+$ProductSizeMB$+" MB"))
LogError "Nicht genuegend Platz auf C: . "+$ProductSizeMB$+" MB auf C: fuer "+$ProductName$+" erforderlich."
else

; show product picture
ShowBitmap /3 "%scriptpath%\localsetup\"+$ProductName$+".png" $ProductName$

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

; we need to reboot now to be sure that the autologon work

; Reboot initialisieren ...
Set $RebootFlag$ = "1"
Registry_SaveRebootFlag
ExitWindows /ImmediateReboot

endif ; genuegend platz

else ; Rebootflag "1" oder "2"

if ($RebootFlag$ = "1")
;=========================
; Anweisungen nach Reboot
; Rebootflag weitersetzen
Set $RebootFlag$ = "2"
Registry_SaveRebootFlag

; die eigentlichen Anweisungen

Message "Preparing "+$ProductName$+" install step 2..."
Registry_enable_keyboard
ExitWindows /ImmediateLogout
; now let the autologon work
; it will stop with a reboot

else

if ($RebootFlag$ = "2")
;=========================
; statements after second reboot
Set $RebootFlag$ = "0"
Registry_SaveRebootFlag

; This part must be here even if nothing is done
; possibly we do some cleanup
Message "Cleanup "+$ProductName$+" install ..."
sub_Restore_AutoLogon
;##########################################################################################
Message "Setze .NET-Rechte für Programm ..."
; Rechte für Programm setzen:
Set $uncpath_1$ = IniVar("uncpfad_1")
;
Set $uncpath_2$ = IniVar("uncpfad_2")
;
if FileExists("%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CasPol.exe")
;
DOSInAnIcon_programm-dotnet
sub_check_exitcode
else
logError "Fatal: Programm caspol.exe zum Setzen der .NET-Rechte nicht gefunden! "+$ExitCode$
isFatalError
endif
; This is the clean end of the installation

endif ; Rebootflag = 2

endif ; "1" oder "2"

endif

endif

[sub_Prepare_AutoLogon]
; copy the setup script and files
Files_copy_Setup_files_local
; read actual Autologon values for backup
set $AutoName$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultUserName")
; if AutoLogonName is our setup admin user, something bad happend
; then let us cleanup
if ($AutoName$="opsiSetupAdmin")
set $AutoName$=""
set $AutoPass$=""
set $AutoDom$=""
set $AutoLogon$="0"
else
set $AutoPass$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultPassword")
set $AutoDom$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultDomainName")
set $AutoLogon$ = GetRegistryStringValue ("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] AutoAdminLogon")
endif
; backup AutoLogon values
Registry_save_autologon
; prepare the admin AutoLogon
;LogLevel="$PasswdLogLevel$"
LogLevel=-2
;
; !!! randomstr included in opsi 2.5 winst32.exe 4.2.x !!!
;

set $OpsiAdminPass$= randomstr
Registry_autologon
; create our setup admin user
DosInAnIcon_makeadmin
LogLevel=2
; remove c:\tmp\winst.bat with password
Files_remove_winst_bat

; store our setup script as run once
comment "set entry in runonce"
Registry_runOnce
; disable keyboard and mouse while the autologin admin works
if ($LockKeyboard$="true")
Registry_disable_keyboard
endif

[sub_Restore_AutoLogon]
; read AutoLogon values from backup
set $AutoName$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultUserName")
set $AutoPass$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultPassword")
set $AutoDom$= GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultDomainName")
set $AutoLogon$= GetRegistryStringValue("["+$AutoBackupKey$+"] AutoAdminLogon")
; restore the values
;LogLevel="$PasswdLogLevel$"
LogLevel=-2
Registry_restore_autologon
LogLevel=2
; delete our setup admin user
DosInAnIcon_deleteadmin
; cleanup setup script, files and profiledir
Files_delete_Setup_files_local
; delete profiledir
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]
checktargetpath="$LocalFilesPath$"
; Hier habe ich das Ziel angefuegt:
copy -s "%ScriptPath%\localsetup\*.*" "$LocalFilesPath$"

[Files_delete_Setup_files_local]
delete -sf $LocalFilesPath$
; folgender Befehl funktioniert nicht vollstaendig, deshalb ist er zur Zeit auskommentier
; 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"="opsiSetupAdmin"
set "DefaultPassword"="$OpsiAdminPass$"
set "DefaultDomainName"="%PCNAME%"
set "AutoAdminLogon"="1"

[Registry_runonce]
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
set "opsi_autologon_setup"='"$LocalWinst$" "$LocalFilesPath$\$LocalSetupScript$" "c:\tmp\localinst.log" /batch'

[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

;
[DOSInAnIcon_programm-dotnet]
%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CasPol.exe -pp off -m -ag 1. -url file:$uncpath_1$/* FullTrust
%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CasPol.exe -pp off -m -ag 1. -url file:$uncpath_2$/* FullTrust
;"%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CasPol.exe -pp off -m -ag 1. -url file://server_02/Module/programm/* FullTrust"

[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 ... S.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

Alle Scripte zusammen:
dotnet-W2K-problem.tar.bz2
Antworten