ich versuche gerade ein Script zu schreiben. Welches nur bei einer bestimmten Grafikkarte eine Installation ausführt. Leider finde ich bis jetzt nicht das Richtige. Das Script installiert und deinstalliert die Treiber der Karte und ich kann im Registryschlüssel die Karte auslesen. Hab ich aber mehr als ein Eintrag, kann ich nicht die anderen Einträge auslesen lassen.
Damit klappt die Abfrage und Installation. Aber nur wenn "0001" vorgebe.
Code: Alles auswählen
; ----------------------------------------------------------------
; This is a opsi-script file.
; See https://opsi.org https://uib.de
; This code was originally created by opsi-setup-detector 4.2.0.10
; ----------------------------------------------------------------
encoding=utf8
[Actions]
requiredOpsiscriptVersion >= "4.12.4.23"
importlib "uib_exitcode.opsiscript"
importlib "osd-lib.opsiscript"
; All variables are defined here:
include_insert "define_vars_multi.opsiscript"
; ----------------------------------------------------------------
; $ProductId$ is the name of the product in opsi, only lower letters, no umlauts, no white spaces, use '-' as a seperator
Set $ProductId$ = "nvidia"
; the path where we find the product after the installation
Set $InstallDir$ = "unknown"
Set $LicenseRequired$ = "False"
Set $LicensePool$ = ""
Set $MinimumSpace$ = "10240 MB"
; ----------------------------------------------------------------
set $OS$ = GetOS
if not(($OS$ = "Windows_NT"))
logError "Installation aborted: wrong OS version: only Windows"
isFatalError "wrong OS"
endif
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
; Stop process and set installation status to failed
endif
Set $GraphicCard$ = getRegistryKeyListSysnative("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}")
set $RegistryKey$ = "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\" + "0001" + "]"
Set $Cardname$ = GetRegistryStringValueSysNative($RegistryKey$ + "DriverDesc")
if not(($Cardname$ = "NVIDIA Quadro P400"))
logError "Installation aborted: wrong Graphic Card: only NVIDIA Quadro P400"
isFatalError "wrong Graphic Card"
endif
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
if FileExists("%ScriptPath%\delsub.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.opsiscript"
endif
Message "Installing " + $ProductId$ + " ..."
if $LicenseRequired$ = "true"
comment "Licensing required, reserve license and get license key"
set $LicenseKey$ = get_licensekey_byPoolOrKey($LicensePool$)
endif
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%\files1"
;----------------------------------------------
;Winbatch_install
DosBatch_install
;----------------------------------------------
set $ExitCode$ = getlastexitcode
if "true" = isMsExitcodeFatal_short($exitcode$, "true", $ErrorString$ )
LogError $ErrorString$
isfatalerror $ErrorString$
else
Comment $ErrorString$
endif
;[Winbatch_install]
;"%scriptpath%\files1\setup.exe" /clean /n /noeula /passive
[DosBatch_install]
"%ScriptPath%\install.bat"
Meine Frage daher: 1. Wie kann ich opsi sagen, er soll alle Einträge abfragen?
2. Und wenn die Karte gefunden, wurde er den Treiber installiert?
Vielen Dank und liebe Grüße
Maik