Ich möchte ein String aus einem powershellCall mit einigen anderen Strings vergleichen und eine Ausgabe herausgeben.
Ich habe versucht StringList in meinem Switch zu verwenden das funktioniert aber leider nicht.
Comparing a stringlist to a string probably doesn't work. You will need to compare each entry in the stringlist to the string. What are the contents of $Grafikkarte$ and $Test$?
Set $result$ = getRegistryKeyListSysnative("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}")
for $value$ in $result$ do Sub_network_wake_on_lan
[Sub_network_wake_on_lan]
set $RegistryKey$ = "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" + "$value$" + "]"
Set $testName$ = GetRegistryStringValueSysNative($RegistryKey$ + "DriverDesc")
if contains($testName$,"82579")
Registry_install_Intel_82579
endif
if contains($testName$,"82574")
Registry_install_Intel_82574
endif
if (contains($testName$,"I217") or contains($testName$,"I210"))
Registry_install_Intel_217
endif
if contains($testName$,"I354")
Registry_install_Intel_354
endif
if contains($testName$,"82566")
Registry_install_Intel_82566
endif
if contains($testName$,"nForce")
Registry_install_Nvidia_nForce
endif
if (contains($testName$,"AR8121") or contains($testName$,"AR8113") or contains($testName$,"AR8114"))
Registry_install_Atheros_AR8121
endif
if contains($testName$,"Realtek PCIe")
Registry_install_Realtek_PCIe
endif
[Registry_install_Intel_354]
openkey $RegistryKey$
set "EnablePME" = "1"
set "*WakeOnMagicPacket"="1"
set "*WakeOnPattern"="1"
[Registry_install_Intel_217]
openkey $RegistryKey$
set "EnablePME" = "1"
set "*WakeOnMagicPacket"="1"
set "*WakeOnPattern"="1"
[Registry_install_Intel_82579]
openkey $RegistryKey$
set "EnablePME" = "1"
set "WakeOn"="118"
[Registry_install_Intel_82574]
openkey $RegistryKey$
set "EnablePME" = "1"
set "WakeOn"="118"
[Registry_install_Intel_82566]
openkey $RegistryKey$
set "EnablePME" = "1"
set "WakeOn"="118"
[Registry_install_Nvidia_nForce]
openkey $RegistryKey$
set "EthWOLFromPowerOff" = "1"
set "WakeUpMagic" = "1"
set "WakeUpPattern" = "1"
[Registry_install_Atheros_AR8121]
openkey $RegistryKey$
set "ShutdownWake" = "1"
set "WakeUpCapabilities" = "3"
[Registry_install_Realtek_PCIe]
openkey $RegistryKey$
set "S5WakeOnLan" = "1"
set "WolCap" = "3"
In your case, the key for display adapters is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}
The same DriverDesc can be used.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Wir haben keine Rechner mit mehreren Grafikkarten. Aber ein guter Einwand, ich weiß nicht welchen Output andere Grafikkarten haben.
Das hätte ich noch Getestet.
Also gibt es keine Möglichkeit ein Stringlist mit einem String zu vergleichen?
NIck hat geschrieben: ↑04 Mai 2022, 16:31
Also gibt es keine Möglichkeit ein Stringlist mit einem String zu vergleichen?
You will have to use a for schleife.
In the workaround, $result$ is a stringlist.
so that kinda works the same. either use a sub or do a direct comparison.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
SisterOfMercy hat geschrieben: ↑04 Mai 2022, 14:07
Comparing a stringlist to a string probably doesn't work. You will need to compare each entry in the stringlist to the string. What are the contents of $Grafikkarte$ and $Test$?
Set $result$ = getRegistryKeyListSysnative("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}")
for $value$ in $result$ do Sub_network_wake_on_lan
[Sub_network_wake_on_lan]
set $RegistryKey$ = "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" + "$value$" + "]"
Set $testName$ = GetRegistryStringValueSysNative($RegistryKey$ + "DriverDesc")
if contains($testName$,"82579")
Registry_install_Intel_82579
endif
if contains($testName$,"82574")
Registry_install_Intel_82574
endif
if (contains($testName$,"I217") or contains($testName$,"I210"))
Registry_install_Intel_217
endif
if contains($testName$,"I354")
Registry_install_Intel_354
endif
if contains($testName$,"82566")
Registry_install_Intel_82566
endif
if contains($testName$,"nForce")
Registry_install_Nvidia_nForce
endif
if (contains($testName$,"AR8121") or contains($testName$,"AR8113") or contains($testName$,"AR8114"))
Registry_install_Atheros_AR8121
endif
if contains($testName$,"Realtek PCIe")
Registry_install_Realtek_PCIe
endif
[Registry_install_Intel_354]
openkey $RegistryKey$
set "EnablePME" = "1"
set "*WakeOnMagicPacket"="1"
set "*WakeOnPattern"="1"
[Registry_install_Intel_217]
openkey $RegistryKey$
set "EnablePME" = "1"
set "*WakeOnMagicPacket"="1"
set "*WakeOnPattern"="1"
[Registry_install_Intel_82579]
openkey $RegistryKey$
set "EnablePME" = "1"
set "WakeOn"="118"
[Registry_install_Intel_82574]
openkey $RegistryKey$
set "EnablePME" = "1"
set "WakeOn"="118"
[Registry_install_Intel_82566]
openkey $RegistryKey$
set "EnablePME" = "1"
set "WakeOn"="118"
[Registry_install_Nvidia_nForce]
openkey $RegistryKey$
set "EthWOLFromPowerOff" = "1"
set "WakeUpMagic" = "1"
set "WakeUpPattern" = "1"
[Registry_install_Atheros_AR8121]
openkey $RegistryKey$
set "ShutdownWake" = "1"
set "WakeUpCapabilities" = "3"
[Registry_install_Realtek_PCIe]
openkey $RegistryKey$
set "S5WakeOnLan" = "1"
set "WolCap" = "3"
In your case, the key for display adapters is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}
The same DriverDesc can be used.
Dürfte ich fragen als was du deine Variablen Initialisiert hast?