[gelöst] instlog zeigt kein PowerShell echo Ausgabe an

Antworten
Degan
Beiträge: 25
Registriert: 19 Dez 2022, 09:37

[gelöst] instlog zeigt kein PowerShell echo Ausgabe an

Beitrag von Degan »

Ich möchte über opsi-script ein Powershell-Skript ausführen. Dazu habe ich hier ein Beispiel aus dem Handbuch gefunden bzw. sowas ähnliches habe ich im Forum hier auch schon entdeckt. Ich habe das Problem, dass ich z.B. über den echo Command keine Logs in instlog angezeigt bekommen kriege.

Das Skript läuft angeblich ohne Probleme durch. Andere Dateien wie .MSI- Produkte lassen sich Problemlos installieren.

Code: Alles auswählen

DosInAnIcon_setpolicy
ExecWith_powershell  powershell.exe

[DosInAnIcon_setpolicy]
echo "powershell set-executionpolicy RemoteSigned ..."
powershell.exe set-executionpolicy RemoteSigned


[ExecWith_powershell]
echo "powershell opsi-script-test"
Und hier ist instlog:

Code: Alles auswählen

(95)      [1] [2023-01-10 15:16:41.349] [chocolatey] 
(96)      [1] [2023-01-10 15:16:41.349] [chocolatey] ============ Version 4.12.6.2 script "p:\chocolatey\setup.opsiscript"
(97)      [1] [2023-01-10 15:16:41.349] [chocolatey]              used script encoding: cp1252
(98)      [1] [2023-01-10 15:16:41.349] [chocolatey]              used system encoding: cp1252
(99)      [1] [2023-01-10 15:16:41.349] [chocolatey]              start: 2023-01-10  15:16:41
(100)     [1] [2023-01-10 15:16:41.349] [chocolatey]              installing product: chocolatey_1.0.0-1
(101)     [1] [2023-01-10 15:16:41.349] [chocolatey]              on client named    "w03.lab.example.de"
(102)     [1] [2023-01-10 15:16:41.350] [chocolatey]              loggedin user    "Administrator"
(103)     [1] [2023-01-10 15:16:41.350] [chocolatey]              opsi-script running as    "SYSTEM"
(104)     [1] [2023-01-10 15:16:41.350] [chocolatey]              opsi-script running with admin privileges
(105)     [1] [2023-01-10 15:16:41.350] [chocolatey]              opsi-script running in standard script mode
(106)     [1] [2023-01-10 15:16:41.350] [chocolatey] Scaling for screen DPI: 96
(107)     [1] [2023-01-10 15:16:41.350] [chocolatey] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\opsi-script.exe"
(108)     [1] [2023-01-10 15:16:41.350] [chocolatey] system infos:
(109)     [1] [2023-01-10 15:16:41.352] [chocolatey] 6C-6A-77-D6-FF-A0  -  PC hardware address
(110)     [1] [2023-01-10 15:16:41.352] [chocolatey] w03  -  IP name
(111)     [1] [2023-01-10 15:16:41.352] [chocolatey] 192.168.178.234  -  IP address
(112)     [1] [2023-01-10 15:16:41.352] [chocolatey] DEU  -  System default locale
(113)     [7] [2023-01-10 15:16:41.352] [chocolatey] Registry started without redirection (64 Bit)
(114)     [7] [2023-01-10 15:16:41.352] [chocolatey] Registry started readonly
(115)     [7] [2023-01-10 15:16:41.352] [chocolatey] Registry started without redirection (64 Bit)
(116)     [6] [2023-01-10 15:16:41.352] [chocolatey] Registry key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion] opened
(117)     [6] [2023-01-10 15:16:41.352] [chocolatey] Key closed
(118)     [7] [2023-01-10 15:16:41.352] [chocolatey] Registry started without redirection (64 Bit)
(119)     [7] [2023-01-10 15:16:41.352] [chocolatey] Registry started readonly
(120)     [7] [2023-01-10 15:16:41.352] [chocolatey] Registry started without redirection (64 Bit)
(121)     [6] [2023-01-10 15:16:41.352] [chocolatey] Registry key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion] opened
(122)     [6] [2023-01-10 15:16:41.352] [chocolatey] Key closed
(123)     [1] [2023-01-10 15:16:41.352] [chocolatey] MS Windows 10.0 64 Bit, Release: 22H2, Edition: PRODUCT_PROFESSIONAL
(124)     [1] [2023-01-10 15:16:41.352] [chocolatey] opsi service version : 4
(125)     [1] [2023-01-10 15:16:41.352] [chocolatey] 
(126)     [7] [2023-01-10 15:16:41.353] [chocolatey] Registry started readonly
(127)     [7] [2023-01-10 15:16:41.353] [chocolatey] Registry started without redirection (64 Bit)
(128)     [6] [2023-01-10 15:16:41.353] [chocolatey] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion] opened
(129)     [6] [2023-01-10 15:16:41.353] [chocolatey] Key closed
(130)     [6] [2023-01-10 15:16:41.357] [chocolatey] Try getting FQDN with WMI:
(131)     [6] [2023-01-10 15:16:41.383] [chocolatey] WMI result for FQDN: w03.lab.example.de
(132)     [5] [2023-01-10 15:16:41.383] [chocolatey] 
(133)     [1] [2023-01-10 15:16:41.435] [chocolatey] ___________________
(134)     [1] [2023-01-10 15:16:41.435] [chocolatey] script finished: success
(135)     [1] [2023-01-10 15:16:41.435] [chocolatey] 0 errors
(136)     [1] [2023-01-10 15:16:41.435] [chocolatey] 0 warnings
(137)     [1] [2023-01-10 15:16:41.435] [chocolatey] 
(138)     [1] [2023-01-10 15:16:41.435] [chocolatey] handled product: chocolatey Version: 1.0.0-1
(139)     [1] [2023-01-10 15:16:41.435] [chocolatey] 
(140)     [6] [2023-01-10 15:16:41.479] [chocolatey] HTTPSender Post succeeded
(141)     [6] [2023-01-10 15:16:41.479] [chocolatey] Server-FQDN: opsi-server.lab.example.de Server-IP: 192.168.178.4
(142)     [6] [2023-01-10 15:16:41.479] [chocolatey] JSON Bench for setProductActionRequest "params":["chocolatey","w03.lab.example.de","updat Start: 15:16:41:436 Time: 00:00:00:043
(143)     [1] [2023-01-10 15:16:41.480] [chocolatey] product chocolatey set to update
(144)     [1] [2023-01-10 15:16:41.480] [chocolatey] Update script name:
(145)     [1] [2023-01-10 15:16:41.480] [chocolatey] we have no update script
(146)     [7] [2023-01-10 15:16:41.480] [chocolatey] BuildPC: update switches .....
(147)     [6] [2023-01-10 15:16:41.489] [chocolatey] HTTPSender Post succeeded
(148)     [6] [2023-01-10 15:16:41.489] [chocolatey] Server-FQDN: opsi-server.lab.example.de Server-IP: 192.168.178.4
(149)     [6] [2023-01-10 15:16:41.489] [chocolatey] JSON Bench for productOnClient_updateObject "params":[{"clientId":"w03.lab.example.de","action Start: 15:16:41:480 Time: 00:00:00:009
(150)     [7] [2023-01-10 15:16:41.490] [] Registry started with redirection (32 Bit)
(151)     [6] [2023-01-10 15:16:41.490] [] Registry key [HKLM\SOFTWARE\opsi.org\winst] opened
(152)     [6] [2023-01-10 15:16:41.490] []                   Variable "RebootRequested"  is keeping its value "0"
(153)     [6] [2023-01-10 15:16:41.490] []                   Variable "LastLogFilename"  is keeping its value "c:\opsi.org\log\opsi-script.log"
(154)     [6] [2023-01-10 15:16:41.490] []                   Variable "ContinueLogFile"  is keeping its value "0"
(155)     [6] [2023-01-10 15:16:41.490] []                   Variable "NumberOfErrors"  not found. Code: 2
(156)     [6] [2023-01-10 15:16:41.492] []                   Key flushed
(157)     [6] [2023-01-10 15:16:41.492] []                   Key closed
(158)     [6] [2023-01-10 15:16:41.501] []                   HTTPSender Post succeeded
(159)     [6] [2023-01-10 15:16:41.501] []                   Server-FQDN: opsi-server.lab.example.de Server-IP: 192.168.178.4
(160)     [6] [2023-01-10 15:16:41.501] []                   JSON Bench for backend_getSystemConfiguration "params":[],"id":1} Start: 15:16:41:495 Time: 00:00:00:006
(161)     [6] [2023-01-10 15:16:41.501] []                   Checking if partlog: is bigger than 4 MB :.
(162)     [6] [2023-01-10 15:16:41.501] []                   Checking if partlog: c:\opsi.org\log\\opsi-script-part-9U6nUd52kD.log is bigger than 4 MB - found: 0 MB
(163)     [5] [2023-01-10 15:16:41.501] [] -------- submitted part of log file ends here, see the rest of log file on client ----------
Handbuch: https://download.uib.de/4.2/documentati ... (Modifier)
Benutzeravatar
j.werner
uib-Team
Beiträge: 64
Registriert: 08 Okt 2019, 13:32

Re: instlog zeigt kein PowerShell echo Ausgabe an

Beitrag von j.werner »

Hallo Degan,

fehlt evtl. ein

Code: Alles auswählen

[Actions]
am Anfang von deinem Skript?

Viele Grüße Jan
Degan
Beiträge: 25
Registriert: 19 Dez 2022, 09:37

Re: instlog zeigt kein PowerShell echo Ausgabe an

Beitrag von Degan »

So, habe jetzt den LogLevel angepasst, jetzt hats geklappt.

Code: Alles auswählen

[Initial]
setLogLevel=9
ExitOnError=false
ScriptErrorMessages=on
TraceMode=off
StayOnTop=false

[Actions]
setLogLevel=9
DosInAnIcon_setpolicy
ExecWith_powershell  powershell.exe

[DosInAnIcon_setpolicy]
echo "powershell set-executionpolicy RemoteSigned ..."
powershell.exe set-executionpolicy RemoteSigned

[ExecWith_powershell]
echo "powershell opsi-script-test"
Antworten