jaegermasterParticipantAugust 8, 2017 at 11:19 amPost count: 29
I execute in my script various commands and would like to get into the main script log the output I get when executing it from a command prompt/PS shell, how could I achieve this correctly ?
here are examples of commands :
Execute-process -Path “control.exe” -Parameters “intl.cpl,, /f:
"$dirFiles\CopyInternationalSettings.xml“” -IgnoreExitCodes 1
Dism /online /Get-Capabilities /Limitaccess
Thank you in advance
FrancoisParticipantAugust 9, 2017 at 2:09 amPost count: 105
<code>Execute-process -Path "$env:windir\system32\control.exe” -Parameters "intl.cpl,, /f:"$dirFiles\CopyInternationalSettings.xml"” -IgnoreExitCodes 1 Execute-process -path "Dism" -parameters "/online /Get-Capabilities /Limitaccess"</code>
Are you running your script in interactive mode?
You may use write-logs to show what is happening in your script.
I don’t know if there are any parameters with DISM to create a log file.
jaegermasterParticipantAugust 9, 2017 at 9:16 amPost count: 29
Ok let me clarify :
here is what happens when I launch one of those commands in prompt
<code> C:\WINDOWS\system32>Dism /online /Get-Capabilities /Limitaccess Deployment Image Servicing and Management tool Version: 10.0.14393.0 Image Version: 10.0.14393.0 Capability listing: Capability Identity : App.Support.ContactSupport~~~~0.0.1.0 State : Installed Capability Identity : App.Support.QuickAssist~~~~0.0.1.0 State : Installed Capability Identity : Language.Basic~~~en-US~0.0.1.0 State : Installed Capability Identity : Language.Handwriting~~~en-US~0.0.1.0 State : Installed Capability Identity : Language.OCR~~~en-US~0.0.1.0 State : Installed</code>
I want to get back the the ouptu in write log
and yes dism can log in a seperate log, but I want it inside the PSADT script log, just like SCCM does with the smsts.log for task sequences
AdrianParticipantAugust 11, 2017 at 9:40 amPost count: 1
use the -passthru switch.
Something like this:
$variable = execute-process -path(join-path -path $dirfiles -childpath “Dism”) parameters “/online /Get-Capabilities /Limitaccess” -passthru
$variable object will have properties stdout, stderr & ExitCode
jaegermasterParticipantAugust 17, 2017 at 9:47 amPost count: 29
Hi, thanks a lot, I didn’t think of that
we are almost there 🙂
$DismOutput = Execute-process -Path ‘Dism.exe’ -Parameters “/online /Get-Capabilities /Limitaccess” -passth
and I get all output in same line
is there a way of having the line breaks , menaing one line in log per line in the stdout?
I am thinking of using an array and doing a write-log for each line
jaegermasterParticipantAugust 17, 2017 at 11:49 amPost count: 29
You must be logged in to reply to this topic.