Formatierung der Standardausgabe von externen Anwendungen

Antworten
larsg
Beiträge: 283
Registriert: 16 Dez 2014, 18:06

Formatierung der Standardausgabe von externen Anwendungen

Beitrag von larsg »

Der Output von Prozessen, die via Winbatch/DosBatch/ExecWith ausgeführt werden, erscheint in der opsi-script-Logdatei fast immer als ein riesiger Klumpen, mit \n getrennt da wo normalerweise eine neue Zeile anfängt.
Lässt sich das nicht OPSI-seitig so verarbeiten das dies auch in der Logdatei jeweils als neue Zeile erscheint?

Ich habe das Problem aktuell mit einer ExecWith-Sektion in Verbindung mit PowerShell. Gibt es eine Möglichkeit die Ausgabe in Powershell irgendwie so zu beeinflussen, das die Einträge in der Logdatei richtig angezeigt werden?
larsg
Beiträge: 283
Registriert: 16 Dez 2014, 18:06

Re: Formatierung der Standardausgabe von externen Anwendungen

Beitrag von larsg »

Irgendein Output hierzu?

Hier mal ein Beispiel zur Reproduktion:

Winst-Script

Code: Alles auswählen

Encoding=utf8

[Actions]
SetLogLevel = 9
RequiredWinstVersion >= "4.12"
MaximizeWinst
StayOnTop = false
AutoActivityDisplay = false
ExitOnError = true
FatalOnSyntaxError = true
FatalOnRuntimeError = true
ScriptErrorMessages = false
TraceMode = off

ExecWith_psadt_exe powershell.exe -ExecutionPolicy ByPass -WindowStyle Hidden WINST /SysNative /RunElevated

[ExecWith_psadt_exe]
Write-Host "Test1"
Write-Host "Test2"
Write-Host "Test3"
Opsi-Log

Code: Alles auswählen

(0)       
(1)       [1] [2022-07-06 16:55:23.245] [] --
(2)       [1] [2022-07-06 16:55:23.245] [] --
(3)       [1] [2022-07-06 16:55:23.246] [] c:\opsi.org\log\\opsi-script-part-Sn1M35amM0.log
(4)       [1] [2022-07-06 16:55:23.246] [] opsi-script 4.12.4.37 started at >>
(5)       [1] [2022-07-06 16:55:23.247] [] opsi-script log file with encoding utf8
(6)       [1] [2022-07-06 16:55:23.247] [] ssl library path: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(7)       [1] [2022-07-06 16:55:23.247] [] ssl library path: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\libeay32.dll
(8)       [1] [2022-07-06 16:55:23.247] [] Load library: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\libeay32.dll
(9)       [1] [2022-07-06 16:55:23.250] [] Load library: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(10)      [1] [2022-07-06 16:55:23.250] [] startmessage opsi-script created at CentralForm.FormCreate: 06.07.2022 16:55:22
(11)      [1] [2022-07-06 16:55:23.250] [] Detected Language is:de
(12)      [1] [2022-07-06 16:55:23.250] [] Loading skin from: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\..\custom\winstskin
(13)      [1] [2022-07-06 16:55:23.250] [] Called with parameter: /opsiservice\r\nhttps://10.101.47.95:4447/rpc\r\n/clientid\r\nl01451.ci.civitec.de\r\n/username\r\nl01451.ci.civitec.de\r\n/password\r\n***(confidential)***
(14)      [1] [2022-07-06 16:55:23.250] [] Depot path from readconfig:  p:\ 06.07.2022 16:55:22
(15)      [1] [2022-07-06 16:55:23.250] [] startmessage StartProgramModes and create log: 06.07.2022 16:55:22
(16)      [1] [2022-07-06 16:55:23.250] [] Compiled with FPC: 3.2.2 for: Win32-i386
(17)      [1] [2022-07-06 16:55:23.250] [] pm: 5 06.07.2022 16:55:22
(18)      [1] [2022-07-06 16:55:23.250] [] startmessage start opsi service connection: 06.07.2022 16:55:22
(19)      [1] [2022-07-06 16:55:23.250] [] startmessage: opsidata initialized: 06.07.2022 16:55:22
(20)      [1] [2022-07-06 16:55:23.250] [] l01451.ci.civitec.de
(21)      [1] [2022-07-06 16:55:23.250] [] Starting Servicecall: backend_info
(22)      [1] [2022-07-06 16:55:23.250] [] Success Servicecall: backend_info
(23)      [1] [2022-07-06 16:55:23.250] [] got AutoActivityDisplay: true
(24)      [1] [2022-07-06 16:55:23.250] [] got debug_lib: true
(25)      [1] [2022-07-06 16:55:23.250] [] got debug_prog: false
(26)      [1] [2022-07-06 16:55:23.250] [] got default_loglevel: 7
(27)      [1] [2022-07-06 16:55:23.250] [] got config: opsi-script.global.force_min_loglevel
(28)      [1] [2022-07-06 16:55:23.250] [] got force_min_loglevel: false
(29)      [1] [2022-07-06 16:55:23.250] [] Error: Not an Integer:  force_min_loglevel: false
(30)      [1] [2022-07-06 16:55:23.250] [] got config: opsi-script.global.log_rotation_count
(31)      [1] [2022-07-06 16:55:23.250] [] got log_rotation_count: 8
(32)      [1] [2022-07-06 16:55:23.250] [] got ReverseProductOrderByUninstall: false
(33)      [1] [2022-07-06 16:55:23.250] [] got ScriptErrorMessages: false
(34)      [1] [2022-07-06 16:55:23.250] [] got supressSystemEncodingWarning: false
(35)      [1] [2022-07-06 16:55:23.250] [] got w10BitlockerSuspendOnReboot: false
(36)      [1] [2022-07-06 16:55:23.250] [] got writeProductLogFile: 8
(37)      [1] [2022-07-06 16:55:23.250] [] readConfigFromService: ok
(38)      [1] [2022-07-06 16:55:23.250] [] startmessage create log: 06.07.2022 16:55:23
(39)      [1] [2022-07-06 16:55:23.250] [] Cleanup old part files at 06.07.2022 16:55:23
(40)      [1] [2022-07-06 16:55:23.250] [] Backup old log files at 06.07.2022 16:55:23
(41)      [1] [2022-07-06 16:55:23.250] [] Initiate new log file at 06.07.2022 16:55:23
(42)      [1] [2022-07-06 16:55:23.250] [] force_min_loglevel: 0
(43)      [1] [2022-07-06 16:55:23.250] [] default_loglevel: 7
(44)      [1] [2022-07-06 16:55:23.250] [] debug_prog: false
(45)      [1] [2022-07-06 16:55:23.250] [] debug_lib: true
(46)      [7] [2022-07-06 16:55:23.251] [] Testing as temp path: c:\opsi.org\tmp\
(47)      [7] [2022-07-06 16:55:23.251] [] Succseeded: Testing as temp path: c:\opsi.org\tmp\ (06.07.2022 16:55:23)
(48)      [7] [2022-07-06 16:55:23.252] [] Final: Using as temp path: c:\opsi.org\tmp\
(49)      [6] [2022-07-06 16:55:23.252] [] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(50)      [6] [2022-07-06 16:55:23.284] [] JSON Bench for getDepotId "params":["l01451.ci.civitec.de"],"id":1} Start: 16:55:23:252 Time: 00:00:00:032
(51)      [6] [2022-07-06 16:55:23.285] [] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(52)      [6] [2022-07-06 16:55:23.389] [] JSON Bench for getProductOrdering "params":["li8v08.intern.civitec.de"],"id":1} Start: 16:55:23:284 Time: 00:00:00:105
(53)      [6] [2022-07-06 16:55:23.391] [] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(54)      [6] [2022-07-06 16:55:23.445] [] JSON Bench for productOnClient_getObjects "params":["",{"clientId":"l01451.ci.civitec.de","p Start: 16:55:23:391 Time: 00:00:00:054
(55)      [1] [2022-07-06 16:55:27.057] [] Computername:l01451.ci.civitec.de
(56)      [1] [2022-07-06 16:55:27.057] [] Computername according to Environment Variable :L01451
(57)      [1] [2022-07-06 16:55:27.057] [] opsi service URL https://10.101.47.95:4447
(58)      [6] [2022-07-06 16:55:27.057] [] Depot path:  p:\
(59)      [6] [2022-07-06 16:55:27.057] [] 
(60)      [7] [2022-07-06 16:55:27.062] [] bootmode from registry: BKSTD
(61)      [6] [2022-07-06 16:55:27.062] [] Bootmode: BKSTD
(62)      [6] [2022-07-06 16:55:27.062] [] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(63)      [6] [2022-07-06 16:55:27.062] [] Resolved sequence of products (06.07.2022 16:55:27):
(64)      [6] [2022-07-06 16:55:27.067] [] Product 60 	firefox-neu : setup
(65)      [6] [2022-07-06 16:55:27.246] [] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(66)      [6] [2022-07-06 16:55:27.253] [] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(67)      [6] [2022-07-06 16:55:27.286] [] JSON Bench for getProduct_hash "params":["firefox-neu","li8v08.intern.civitec.de" Start: 16:55:27:253 Time: 00:00:00:033
(68)      [7] [2022-07-06 16:55:27.287] [] in TOpsi4Data.initProduct : firefox-neu
(69)      [6] [2022-07-06 16:55:27.287] [] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(70)      [6] [2022-07-06 16:55:27.308] [] JSON Bench for productOnClient_getObjects "params":["",{"clientId":"l01451.ci.civitec.de","p Start: 16:55:27:287 Time: 00:00:00:021
(71)      [6] [2022-07-06 16:55:27.308] [] Actionrequest for product: firefox-neu is (original/actual): (setup / setup)
(72)      [6] [2022-07-06 16:55:27.351] [firefox-neu] Actionrequest for Product: firefox-neu is: setup
(73)      [6] [2022-07-06 16:55:27.353] [firefox-neu] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(74)      [6] [2022-07-06 16:55:27.391] [firefox-neu] JSON Bench for getProductProperties_hash "params":["firefox-neu","l01451.ci.civitec.de"],"i Start: 16:55:27:353 Time: 00:00:00:038
(75)      [6] [2022-07-06 16:55:27.391] [firefox-neu] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(76)      [6] [2022-07-06 16:55:27.414] [firefox-neu] JSON Bench for getProduct_hash "params":["firefox-neu","li8v08.intern.civitec.de" Start: 16:55:27:391 Time: 00:00:00:023
(77)      [7] [2022-07-06 16:55:27.414] [firefox-neu] in TOpsi4Data.initProduct : firefox-neu
(78)      [6] [2022-07-06 16:55:27.415] [firefox-neu] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(79)      [6] [2022-07-06 16:55:27.436] [firefox-neu] JSON Bench for productOnClient_getObjects "params":["",{"clientId":"l01451.ci.civitec.de","p Start: 16:55:27:415 Time: 00:00:00:021
(80)      [6] [2022-07-06 16:55:27.437] [firefox-neu] scriptname: "psadt.opsiscript", special path: "p:\firefox-neu\"
(81)      [6] [2022-07-06 16:55:27.438] [firefox-neu] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(82)      [6] [2022-07-06 16:55:27.466] [firefox-neu] JSON Bench for productOnClient_updateObject "params":[{"clientId":"l01451.ci.civitec.de","acti Start: 16:55:27:438 Time: 00:00:00:028
(83)      [6] [2022-07-06 16:55:27.467] [firefox-neu] Using new Depot path:  p:\
(84)      [7] [2022-07-06 16:55:27.515] [firefox-neu] Load from Unicode file
(85)      [1] [2022-07-06 16:55:27.541] [firefox-neu] 
(86)      [1] [2022-07-06 16:55:27.541] [firefox-neu] ============ Version 4.12.4.37 script "p:\firefox-neu\psadt.opsiscript"
(87)      [1] [2022-07-06 16:55:27.541] [firefox-neu]              used script encoding: utf8
(88)      [1] [2022-07-06 16:55:27.541] [firefox-neu]              used system encoding: utf8
(89)      [1] [2022-07-06 16:55:27.542] [firefox-neu]              start: 2022-07-06  16:55:27
(90)      [1] [2022-07-06 16:55:27.542] [firefox-neu]              installing product: firefox-neu_102.0.0.0-1
(91)      [1] [2022-07-06 16:55:27.542] [firefox-neu]              on client named    "l01451.ci.civitec.de"
(92)      [1] [2022-07-06 16:55:27.544] [firefox-neu]              loggedin user    "gruenheid"
(93)      [1] [2022-07-06 16:55:27.545] [firefox-neu]              opsi-script running as    "SYSTEM"
(94)      [1] [2022-07-06 16:55:27.545] [firefox-neu]              opsi-script running with admin privileges
(95)      [1] [2022-07-06 16:55:27.545] [firefox-neu]              opsi-script running in standard script mode
(96)      [1] [2022-07-06 16:55:27.545] [firefox-neu] Scaling for screen DPI: 96
(97)      [1] [2022-07-06 16:55:27.545] [firefox-neu] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\opsi-script.exe"
(98)      [1] [2022-07-06 16:55:27.546] [firefox-neu] system infos:
(99)      [1] [2022-07-06 16:55:27.551] [firefox-neu] 20-79-18-C6-63-1B  -  PC hardware address
(100)     [1] [2022-07-06 16:55:27.551] [firefox-neu] l01451.ci.civitec.de  -  IP name
(101)     [1] [2022-07-06 16:55:27.552] [firefox-neu] 10.94.72.54  -  IP address
(102)     [1] [2022-07-06 16:55:27.552] [firefox-neu] DEU  -  System default locale
(103)     [7] [2022-07-06 16:55:27.552] [firefox-neu] Registry started without redirection (64 Bit)
(104)     [7] [2022-07-06 16:55:27.553] [firefox-neu] Registry started readonly
(105)     [7] [2022-07-06 16:55:27.553] [firefox-neu] Registry started without redirection (64 Bit)
(106)     [6] [2022-07-06 16:55:27.553] [firefox-neu] Registry key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion]  opened
(107)     [6] [2022-07-06 16:55:27.554] [firefox-neu] Key closed
(108)     [7] [2022-07-06 16:55:27.554] [firefox-neu] Registry started without redirection (64 Bit)
(109)     [7] [2022-07-06 16:55:27.554] [firefox-neu] Registry started readonly
(110)     [7] [2022-07-06 16:55:27.555] [firefox-neu] Registry started without redirection (64 Bit)
(111)     [6] [2022-07-06 16:55:27.555] [firefox-neu] Registry key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion]  opened
(112)     [6] [2022-07-06 16:55:27.555] [firefox-neu] Key closed
(113)     [1] [2022-07-06 16:55:27.556] [firefox-neu] MS Windows 10.0 64 Bit, Release: 21H2, Edition: Enterprise Edition
(114)     [1] [2022-07-06 16:55:27.556] [firefox-neu] opsi service version : 4
(115)     [1] [2022-07-06 16:55:27.556] [firefox-neu] 
(116)     [7] [2022-07-06 16:55:27.558] [firefox-neu] Registry started readonly
(117)     [7] [2022-07-06 16:55:27.559] [firefox-neu] Registry started without redirection (64 Bit)
(118)     [6] [2022-07-06 16:55:27.559] [firefox-neu] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
(119)     [6] [2022-07-06 16:55:27.559] [firefox-neu] Key closed
(120)     [6] [2022-07-06 16:55:27.571] [firefox-neu] Try getting FQDN with WMI:
(121)     [6] [2022-07-06 16:55:27.792] [firefox-neu] WMI result for FQDN: l01451.ci.civitec.de
(122)     [7] [2022-07-06 16:55:27.873] [firefox-neu] Starting with script...
(123)     [6] [2022-07-06 16:55:27.928] [firefox-neu] LogLevel was 7
(124)     [6] [2022-07-06 16:55:27.929] [firefox-neu] LogLevel set to 9
(125)     [9] [2022-07-06 16:55:27.929] [firefox-neu] Parsingprogress: r: RequiredWinstVersion >= "4.12" exp:
(126)     [9] [2022-07-06 16:55:27.929] [firefox-neu] Parsingprogress: r: >= "4.12" exp: RequiredWinstVersion
(127)     [6] [2022-07-06 16:55:27.930] [firefox-neu] opsi-script has version  4.12.4.37, required is : >= 4.12
(128)     [9] [2022-07-06 16:55:27.930] [firefox-neu] Parsingprogress: r: MaximizeWinst exp:
(129)     [9] [2022-07-06 16:55:27.930] [firefox-neu] Parsingprogress: r:  exp: MaximizeWinst
(130)     [9] [2022-07-06 16:55:27.930] [firefox-neu] Parsingprogress: r: StayOnTop = false exp:
(131)     [9] [2022-07-06 16:55:27.930] [firefox-neu] Parsingprogress: r: = false exp: StayOnTop
(132)     [9] [2022-07-06 16:55:27.931] [firefox-neu] Parsingprogress: r: AutoActivityDisplay = false exp:
(133)     [9] [2022-07-06 16:55:27.931] [firefox-neu] Parsingprogress: r: = false exp: AutoActivityDisplay
(134)     [6] [2022-07-06 16:55:27.931] [firefox-neu] AutoActivityDisplay was True is set to false
(135)     [9] [2022-07-06 16:55:27.931] [firefox-neu] Parsingprogress: r: ExitOnError = true exp:
(136)     [9] [2022-07-06 16:55:27.932] [firefox-neu] Parsingprogress: r: = true exp: ExitOnError
(137)     [6] [2022-07-06 16:55:27.932] [firefox-neu] ExitOnError was False is set to true
(138)     [9] [2022-07-06 16:55:27.932] [firefox-neu] Parsingprogress: r: FatalOnSyntaxError = true exp:
(139)     [9] [2022-07-06 16:55:27.932] [firefox-neu] Parsingprogress: r: = true exp: FatalOnSyntaxError
(140)     [6] [2022-07-06 16:55:27.932] [firefox-neu] FatalOnSyntaxError was True is set to true
(141)     [9] [2022-07-06 16:55:27.933] [firefox-neu] Parsingprogress: r: FatalOnRuntimeError = true exp:
(142)     [9] [2022-07-06 16:55:27.933] [firefox-neu] Parsingprogress: r: = true exp: FatalOnRuntimeError
(143)     [6] [2022-07-06 16:55:27.933] [firefox-neu] FatalOnRuntimeError was False is set to true
(144)     [9] [2022-07-06 16:55:27.933] [firefox-neu] Parsingprogress: r: ScriptErrorMessages = false exp:
(145)     [9] [2022-07-06 16:55:27.933] [firefox-neu] Parsingprogress: r: = false exp: ScriptErrorMessages
(146)     [6] [2022-07-06 16:55:27.934] [firefox-neu] ScriptErrorMessages was False is set to false
(147)     [9] [2022-07-06 16:55:27.934] [firefox-neu] Parsingprogress: r: TraceMode = off exp:
(148)     [9] [2022-07-06 16:55:27.934] [firefox-neu] Parsingprogress: r: = off exp: TraceMode
(149)     [9] [2022-07-06 16:55:27.934] [firefox-neu] Parsingprogress: r: ExecWith_psadt_exe powershell.exe -ExecutionPolicy ByPass -WindowStyle Hidden WINST /SysNative /RunElevated exp:
(150)     [9] [2022-07-06 16:55:27.935] [firefox-neu] Parsingprogress: r: powershell.exe -ExecutionPolicy ByPass -WindowStyle Hidden WINST /SysNative /RunElevated exp: ExecWith_psadt_exe
(151)     [9] [2022-07-06 16:55:27.935] [firefox-neu] Looking for section: ExecWith_psadt_exe in standard section.
(152)     [5] [2022-07-06 16:55:27.935] [firefox-neu] Execution of: ExecWith_psadt_exe powershell.exe -ExecutionPolicy ByPass -WindowStyle Hidden WINST /SysNative /RunElevated
(153)     [5] [2022-07-06 16:55:27.935] [firefox-neu] 
(154)     [5] [2022-07-06 16:55:27.936] [firefox-neu] Execution of ExecWith_psadt_exe powershell.exe -ExecutionPolicy ByPass -WindowStyle Hidden WINST /SysNative /RunElevated
(155)     [7] [2022-07-06 16:55:27.939] [firefox-neu]   Found Parameter: /runelevated .
(156)     [8] [2022-07-06 16:55:27.940] [firefox-neu]   powershell programparas are now: -ExecutionPolicy ByPass -WindowStyle Hidden
(157)     [7] [2022-07-06 16:55:27.940] [firefox-neu]   DisableWow64FsRedirection succeeded
(158)     [6] [2022-07-06 16:55:27.940] [firefox-neu]   ShellCall Executing: "C:\Windows\system32\\cmd.exe" /C "powershell.exe get-executionpolicy"
(159)     [7] [2022-07-06 16:55:30.180] [firefox-neu]   ExitCode 0
(160)     [8] [2022-07-06 16:55:30.181] [firefox-neu]   output:
(161)     [8] [2022-07-06 16:55:30.181] [firefox-neu]   --------------
(162)     [8] [2022-07-06 16:55:30.182] [firefox-neu]   Bypass
(163)     [8] [2022-07-06 16:55:30.182] [firefox-neu]   
(164)     [7] [2022-07-06 16:55:30.182] [firefox-neu]   RevertWow64FsRedirection succeeded
(165)     [7] [2022-07-06 16:55:30.183] [firefox-neu]   Save to file with encoding: system
(166)     [8] [2022-07-06 16:55:30.184] [firefox-neu]   Will save (system) encoding to file: C:\opsi.org\tmp\_opsiscript_1g42HSg9xK.ps1 :
(167)     [9] [2022-07-06 16:55:30.185] [firefox-neu]   -----------------
(168)     [9] [2022-07-06 16:55:30.185] [firefox-neu]   -----------------
(169)     [8] [2022-07-06 16:55:30.186] [firefox-neu]   Read file C:\opsi.org\tmp\_opsiscript_1g42HSg9xK.ps1 with encoding: system
(170)     [9] [2022-07-06 16:55:30.186] [firefox-neu]   -----------------
(171)     [7] [2022-07-06 16:55:30.187] [firefox-neu]   Start including tail of LogFile "C:\opsi.org\tmp\_opsiscript_1g42HSg9xK.ps1 with encoding: utf8"
(172)     [7] [2022-07-06 16:55:30.188] [firefox-neu]   ################################################################
(173)     [7] [2022-07-06 16:55:30.188] [firefox-neu]   ==>: Write-Host "Test1"
(174)     [7] [2022-07-06 16:55:30.188] [firefox-neu]   ==>: Write-Host "Test2"
(175)     [7] [2022-07-06 16:55:30.189] [firefox-neu]   ==>: Write-Host "Test3"
(176)     [7] [2022-07-06 16:55:30.189] [firefox-neu]   ################################################################
(177)     [7] [2022-07-06 16:55:30.189] [firefox-neu]   End including LogFile "C:\opsi.org\tmp\_opsiscript_1g42HSg9xK.ps1"
(178)     [9] [2022-07-06 16:55:30.190] [firefox-neu]   -----------------
(179)     [8] [2022-07-06 16:55:30.190] [firefox-neu]   Content of saved file: c:\opsi.org\tmp\_opsiscript_1g42HSg9xK.ps1
(180)     [8] [2022-07-06 16:55:30.190] [firefox-neu]   -----------------------
(181)     [8] [2022-07-06 16:55:30.191] [firefox-neu]   Write-Host "Test1"
(182)     [8] [2022-07-06 16:55:30.191] [firefox-neu]   Write-Host "Test2"
(183)     [8] [2022-07-06 16:55:30.191] [firefox-neu]   Write-Host "Test3"
(184)     [8] [2022-07-06 16:55:30.192] [firefox-neu]   -----------------------
(185)     [6] [2022-07-06 16:55:32.538] [firefox-neu]   ExitCode 0
(186)     [7] [2022-07-06 16:55:32.539] [firefox-neu]           
(187)     [7] [2022-07-06 16:55:32.539] [firefox-neu]           output:
(188)     [7] [2022-07-06 16:55:32.539] [firefox-neu]           --------------
(189)     [7] [2022-07-06 16:55:32.539] [firefox-neu]           Test1\nTest2\nTest3
(190)     [7] [2022-07-06 16:55:32.540] [firefox-neu]   
(191)     [1] [2022-07-06 16:55:32.544] [firefox-neu] ___________________
(192)     [1] [2022-07-06 16:55:32.545] [firefox-neu] script finished: success
(193)     [1] [2022-07-06 16:55:32.545] [firefox-neu] 0 errors
(194)     [1] [2022-07-06 16:55:32.545] [firefox-neu] 0 warnings
(195)     [1] [2022-07-06 16:55:32.546] [firefox-neu] 
(196)     [1] [2022-07-06 16:55:32.546] [firefox-neu] handled product: firefox-neu Version: 102.0.0.0-1
(197)     [1] [2022-07-06 16:55:32.546] [firefox-neu] 
(198)     [8] [2022-07-06 16:55:32.547] [firefox-neu] End of CreateAndProcessScript
(199)     [8] [2022-07-06 16:55:32.547] [firefox-neu] First ProcessNonZeroScript finished
(200)     [9] [2022-07-06 16:55:32.547] [firefox-neu] Parameters in OpsiMethodCall: firefox-neu
(201)     [9] [2022-07-06 16:55:32.547] [firefox-neu] Parameters in OpsiMethodCall: l01451.ci.civitec.de
(202)     [9] [2022-07-06 16:55:32.547] [firefox-neu] Parameters in OpsiMethodCall: update
(203)     [9] [2022-07-06 16:55:32.548] [firefox-neu] Putting to TSuperArray with: "firefox-neu"
(204)     [9] [2022-07-06 16:55:32.548] [firefox-neu] Putting to TSuperArray with: "l01451.ci.civitec.de"
(205)     [9] [2022-07-06 16:55:32.548] [firefox-neu] Putting to TSuperArray with: "update"
(206)     [9] [2022-07-06 16:55:32.548] [firefox-neu] got omc.jsonUrlString: {"method":"setProductActionRequest","params":["firefox-neu","l01451.ci.civitec.de","update"],"id":1}
(207)     [9] [2022-07-06 16:55:32.548] [firefox-neu] got Furl: https://10.101.47.95:4447/rpc
(208)     [9] [2022-07-06 16:55:32.549] [firefox-neu] Putting to TSuperArray with: "firefox-neu"
(209)     [9] [2022-07-06 16:55:32.549] [firefox-neu] Putting to TSuperArray with: "l01451.ci.civitec.de"
(210)     [9] [2022-07-06 16:55:32.549] [firefox-neu] Putting to TSuperArray with: "update"
(211)     [6] [2022-07-06 16:55:32.549] [firefox-neu] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(212)     [9] [2022-07-06 16:55:32.660] [firefox-neu] Putting to TSuperArray with: "firefox-neu"
(213)     [9] [2022-07-06 16:55:32.661] [firefox-neu] Putting to TSuperArray with: "l01451.ci.civitec.de"
(214)     [9] [2022-07-06 16:55:32.661] [firefox-neu] Putting to TSuperArray with: "update"
(215)     [9] [2022-07-06 16:55:32.661] [firefox-neu] Putting to TSuperArray with: "firefox-neu"
(216)     [9] [2022-07-06 16:55:32.661] [firefox-neu] Putting to TSuperArray with: "l01451.ci.civitec.de"
(217)     [9] [2022-07-06 16:55:32.661] [firefox-neu] Putting to TSuperArray with: "update"
(218)     [6] [2022-07-06 16:55:32.662] [firefox-neu] JSON Bench for setProductActionRequest "params":["firefox-neu","l01451.ci.civitec.de","up Start: 16:55:32:548 Time: 00:00:00:114
(219)     [9] [2022-07-06 16:55:32.662] [firefox-neu] Putting to TSuperArray with: "firefox-neu"
(220)     [9] [2022-07-06 16:55:32.662] [firefox-neu] Putting to TSuperArray with: "l01451.ci.civitec.de"
(221)     [9] [2022-07-06 16:55:32.662] [firefox-neu] Putting to TSuperArray with: "update"
(222)     [8] [2022-07-06 16:55:32.662] [firefox-neu] JSON Call: {"method":"setProductActionRequest","params":["firefox-neu","l01451.ci.civitec.de","update"],"id":1} Time: 00:00:00:114
(223)     [1] [2022-07-06 16:55:32.663] [firefox-neu] product firefox-neu set to update
(224)     [8] [2022-07-06 16:55:32.663] [firefox-neu] get Update script name ...
(225)     [8] [2022-07-06 16:55:32.663] [firefox-neu] Update script name:
(226)     [1] [2022-07-06 16:55:32.663] [firefox-neu] Update script name:
(227)     [1] [2022-07-06 16:55:32.663] [firefox-neu] we have no update script
(228)     [7] [2022-07-06 16:55:32.663] [firefox-neu] BuildPC: update switches .....
(229)     [8] [2022-07-06 16:55:32.664] [firefox-neu] In opsi4data.UpdateSwitches, Actionstr: setup
(230)     [9] [2022-07-06 16:55:32.664] [firefox-neu] Parameters in OpsiMethodCall: {"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}
(231)     [9] [2022-07-06 16:55:32.664] [firefox-neu] Creating TSuperObject with: {"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}
(232)     [9] [2022-07-06 16:55:32.665] [firefox-neu] got omc.jsonUrlString: {"method":"productOnClient_updateObject","params":[{"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}],"id":1}
(233)     [9] [2022-07-06 16:55:32.665] [firefox-neu] got Furl: https://10.101.47.95:4447/rpc
(234)     [9] [2022-07-06 16:55:32.665] [firefox-neu] Creating TSuperObject with: {"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}
(235)     [6] [2022-07-06 16:55:32.665] [firefox-neu] SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(236)     [9] [2022-07-06 16:55:32.700] [firefox-neu] Creating TSuperObject with: {"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}
(237)     [9] [2022-07-06 16:55:32.701] [firefox-neu] Creating TSuperObject with: {"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}
(238)     [6] [2022-07-06 16:55:32.702] [firefox-neu] JSON Bench for productOnClient_updateObject "params":[{"clientId":"l01451.ci.civitec.de","acti Start: 16:55:32:664 Time: 00:00:00:038
(239)     [9] [2022-07-06 16:55:32.702] [firefox-neu] Creating TSuperObject with: {"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}
(240)     [8] [2022-07-06 16:55:32.703] [firefox-neu] JSON Call: {"method":"productOnClient_updateObject","params":[{"clientId":"l01451.ci.civitec.de","actionResult":"successful","installationStatus":"installed","actionRequest":"none","packageVersion":"1","ident":"firefox-neu;LocalbootProduct;l01451.ci.civitec.de","productType":"LocalbootProduct","lastAction":"setup","productVersion":"102.0.0.0","modificationTime":null,"productId":"firefox-neu","actionProgress":"","type":"ProductOnClient","targetConfiguration":"installed","actionSequence":null}],"id":1} Time: 00:00:00:039
(241)     [9] [2022-07-06 16:55:32.859] [] BuildPC: saveOpsiConf .....
(242)     [9] [2022-07-06 16:55:32.859] [] BuildPC: saveOpsiConf .....
(243)     [9] [2022-07-06 16:55:32.859] [] BuildPC: handle reboot options: write to registry .....
(244)     [7] [2022-07-06 16:55:32.859] [] Registry started with redirection (32 Bit)
(245)     [6] [2022-07-06 16:55:32.859] [] Registry key [HKLM\SOFTWARE\opsi.org\winst]  opened
(246)     [9] [2022-07-06 16:55:32.859] []                       Found Name: RebootRequested (encoded: RebootRequested) bytes:4
(247)     [9] [2022-07-06 16:55:32.859] []                       successful querying for Value from Name: RebootRequested (encoded: RebootRequested) bytes:4
(248)     [6] [2022-07-06 16:55:32.859] []                       Variable "RebootRequested"  is keeping its value "0"
(249)     [9] [2022-07-06 16:55:32.859] []                       BuildPC: handle reboot options: registry log continue .....
(250)     [9] [2022-07-06 16:55:32.859] []                       Found Name: LastLogFilename (encoded: LastLogFilename) bytes:64
(251)     [9] [2022-07-06 16:55:32.859] []                       successful querying for Value from Name: LastLogFilename (encoded: LastLogFilename) bytes:64
(252)     [9] [2022-07-06 16:55:32.859] []                       Found oldValue: c:\opsi.org\log\opsi-script.log)  bytes:64
(253)     [6] [2022-07-06 16:55:32.860] []                       Variable "LastLogFilename"  is keeping its value "c:\opsi.org\log\opsi-script.log"
(254)     [9] [2022-07-06 16:55:32.860] []                       Found Name: ContinueLogFile (encoded: ContinueLogFile) bytes:4
(255)     [9] [2022-07-06 16:55:32.860] []                       successful querying for Value from Name: ContinueLogFile (encoded: ContinueLogFile) bytes:4
(256)     [6] [2022-07-06 16:55:32.860] []                       Variable "ContinueLogFile"  is keeping its value "0"
(257)     [9] [2022-07-06 16:55:32.860] []                       Found Name: NumberOfErrors (encoded: NumberOfErrors) bytes:4
(258)     [9] [2022-07-06 16:55:32.860] []                       successful querying for Value from Name: NumberOfErrors (encoded: NumberOfErrors) bytes:4
(259)     [9] [2022-07-06 16:55:32.860] []                       Found Name: NumberOfErrors (encoded: NumberOfErrors) bytes:4
(260)     [9] [2022-07-06 16:55:32.860] []                       successful querying for Value from Name: NumberOfErrors (encoded: NumberOfErrors) bytes:4
(261)     [6] [2022-07-06 16:55:32.860] []                       Variable "NumberOfErrors"  is keeping its value "0"
(262)     [6] [2022-07-06 16:55:32.861] []                       Key flushed
(263)     [6] [2022-07-06 16:55:32.861] []                       Key closed
(264)     [8] [2022-07-06 16:55:32.861] []                       BuildPC: finishOpsiconf .....
(265)     [9] [2022-07-06 16:55:32.867] []                       got omc.jsonUrlString: {"method":"backend_getSystemConfiguration","params":[],"id":1}
(266)     [9] [2022-07-06 16:55:32.867] []                       got Furl: https://10.101.47.95:4447/rpc
(267)     [6] [2022-07-06 16:55:32.867] []                       SslLib should be: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-script\ssleay32.dll
(268)     [6] [2022-07-06 16:55:32.896] []                       JSON Bench for backend_getSystemConfiguration "params":[],"id":1} Start: 16:55:32:865 Time: 00:00:00:031
(269)     [8] [2022-07-06 16:55:32.896] []                       JSON Call: {"method":"backend_getSystemConfiguration","params":[],"id":1} Time: 00:00:00:031
(270)     [6] [2022-07-06 16:55:32.896] []                       Checking if partlog: is bigger than 4 MB :.
(271)     [6] [2022-07-06 16:55:32.896] []                       Checking if partlog: c:\opsi.org\log\\opsi-script-part-Sn1M35amM0.log is bigger than 4 MB - found: 0 MB
(272)     [5] [2022-07-06 16:55:32.896] [] -------- submitted part of log file ends here, see the rest of log file on client ----------
Was muss ich ändern, damit die Ausgabe aus Powershell im Log (Zeile 189) zeilenweise erfolgt?
larsg
Beiträge: 283
Registriert: 16 Dez 2014, 18:06

Re: Formatierung der Standardausgabe von externen Anwendungen

Beitrag von larsg »

Ich hab wohl die Ursache gefunden.

Powershell schreibt neue Zeilen im Output standardmäßig als "\n" bzw. "`n" (LF),
wärend ConfigEd & LogViewer für die Interpretation neuer Zeilen scheinbar zwingend zumindest ein "\r" (CR) benötigen.

Workaround für o.g. Beispiel wäre demnach

Code: Alles auswählen

Write-Host "Test1`r"
Write-Host "Test2`r"
Write-Host "Test3`r"
Damit erscheint die Anzeige im Log wie zu erwarten in 3 seperaten Zeilen.

Wäre es möglich, den ConfigEd & LogViewer so anzupassen, das alle varianten (CR, LF, CRLF) jeweils als neue Zeile interpretiert werden?
Antworten