Seite 1 von 1

[GELÖST] powershellCall_list - no valid Expressionstr for a string list

Verfasst: 13 Mai 2020, 11:47
von isnoguter
Hallo,

ich habe endlich Zeit gefunden mich mit dem Thema powershellCall zu beschäftigen. Leider finde ich meinen Fehler nicht.

Ich habe folgendes Beispiel aus dem opsi script manual kopiert. https://download.uib.de/opsi_stable/doc ... lCall_list

Code: Alles auswählen

comment "1"
DefVar $exitcode$
set $exitcode$ = powershellCall('Get-Process -ProcessName "opsi*"')

comment "2"
DefStringList $list2$
set $list2$ = powersshellCall('Get-Process -ProcessName "opsi*"')
Log:

Code: Alles auswählen

(133)     [5] [Mai 13 08:39:11:603] [lra_test]   comment: 1
(134)     [6] [Mai 13 08:39:11:604] [lra_test]   Set  $exitcode$ = powershellCall('Get-Process -ProcessName "opsi*"')
(135)     [5] [Mai 13 08:39:11:604] [lra_test]   PowerhellCall Executing: Get-Process -ProcessName "opsi*" ; mode: sysnative
(136)     [6] [Mai 13 08:39:11:604] [lra_test]   ShellCall Executing: "C:\WINDOWS\\cmd64.exe" /C "powershell.exe get-executionpolicy"
(137)     [6] [Mai 13 08:39:12:334] [lra_test]   ShellCall Executing: "C:\WINDOWS\\cmd64.exe" /C "powershell.exe set-executionpolicy RemoteSigned"
(138)     [6] [Mai 13 08:39:13:056] [lra_test] 
(139)     [6] [Mai 13 08:39:13:056] [lra_test] Execution of tmp-internal powershell.exe winst /sysnative
(140)     [6] [Mai 13 08:39:13:602] [lra_test]   ExitCode 0
(141)     [6] [Mai 13 08:39:13:610] [lra_test]   Search "c:\opsi.org\tmp\"
(142)     [6] [Mai 13 08:39:13:610] [lra_test]   Search "c:\opsi.org\tmp\_opsiscript_*"
(143)     [6] [Mai 13 08:39:13:612] [lra_test] ShellCall Executing: "C:\WINDOWS\\cmd64.exe" /C "powershell.exe set-executionpolicy Restricted"
(144)     [6] [Mai 13 08:39:14:339] [lra_test]     The value of the variable "$exitcode$" is now: "0"
(145)     [5] [Mai 13 08:39:14:339] [lra_test]   comment: 2
(146)     [6] [Mai 13 08:39:14:340] [lra_test]   Set  $list2$ = powersshellCall('Get-Process -ProcessName "opsi*"')
(147)     [2] [Mai 13 08:39:14:341] [lra_test]   Syntax Error in Section: Actions (Command in line 45 in section: Actions; file: setup.opsiscript; section start at line: 1; origin: setup.opsiscript; line: 45): $list2$ = powersshellCall('Get-Process -ProcessName "opsi*"') -> powersshellCall('Get-Process -ProcessName "opsi*"') no valid Expressionstr for a string list
(148)     [2] [Mai 13 08:39:14:341] [lra_test]   Syntax Error in Section: Actions (Command in line 46 in section: Actions; file: setup.opsiscript; section start at line: 1; origin: setup.opsiscript; line: 46): EndIf -> expected
(149)     [1] [Mai 13 08:39:14:341] [lra_test] ___________________
(150)     [1] [Mai 13 08:39:14:341] [lra_test] script finished: failed
(151)     [1] [Mai 13 08:39:14:341] [lra_test] 2 errors
Was mache ich falsch?

Viele Grüße

Re: powershellCall_list - no valid Expressionstr for a string list

Verfasst: 13 Mai 2020, 13:23
von Der-Matze
Hi,

ich vermute in dieser Zeile ist in powershellCall ein "s" zuviel:

Code: Alles auswählen

set $list2$ = powersshellCall('Get-Process -ProcessName "opsi*"')
Das sollte funktionieren:

Code: Alles auswählen

set $list2$ = powershellCall('Get-Process -ProcessName "opsi*"')
Da hat sich wohl ein Typo eingeschlichen :-)
Ich werde das in der Doku korrigieren.

Re: powershellCall_list - no valid Expressionstr for a string list

Verfasst: 13 Mai 2020, 13:50
von isnoguter
Hi,

Danke. Das war der Fehler. Mir ist das echt nicht aufgefallen.

Viele Grüße