使用powershell安装.exe时使用日志文件

使用powershell安装.exe时使用日志文件,powershell,dockerfile,exe,Powershell,Dockerfile,Exe,当我想用powershell安装.msi文件并想使用日志记录时,我使用以下代码: RUN Invoke-WebRequest http://download.microsoft.com/download/0/1/D/01DC28EA-638C-4A22-A57B-4CEF97755C6C/WebDeploy_amd64_en-US.msi -OutFile webdeploy.msi; \ Start-Process msiexec -Wait -ArgumentList '/i webdepl

当我想用powershell安装.msi文件并想使用日志记录时,我使用以下代码:

RUN Invoke-WebRequest http://download.microsoft.com/download/0/1/D/01DC28EA-638C-4A22-A57B-4CEF97755C6C/WebDeploy_amd64_en-US.msi -OutFile webdeploy.msi; \
Start-Process msiexec -Wait -ArgumentList '/i webdeploy.msi /l*v C:\msilog.txt /q' ; \
Remove-Item -Force webdeploy.msi
我在谷歌上搜索了一个.exe文件,但找不到解决方案

因此,我的问题是如何在powerhsell中为以下函数添加日志文件:

RUN Invoke-WebRequest -UseBasicParsing 
https://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A- 
475AB85EEF6E/vcredist_x86.exe -OutFile vcredist_x86.exe; \
powershell.exe -Command Start-Process vcredist_x86.exe -ArgumentList '/quiet' 
| Wait-Process
RUN Invoke-WebRequest -UseBasicParsing 
https://download.microsoft.com/download/9/1/4/914851c6-9141-443b-bdb4- 
8bad3a57bea9/vcredist_x64.exe -OutFile vcredist_x86.exe; \
powershell.exe -Command Start-Process vcredist_x86.exe -ArgumentList '/quiet' 
| Wait-Process

Google上的第一个问题:如果你问如何让任意可执行文件创建日志,那么只有在可执行文件提供日志参数的情况下才有可能。否则,您唯一能做的就是重定向STDOUT上的输出,但Docker应该已经自己记录了。在网站上,它说:/q:a/T:%windir%\temp/c:“VCREDI~2.EXE/q:a/c:“msiexec/i vcredit.msi/qn/l*v%temp%\vcredit\u x64\u 2005.log”“”,但我如何将其应用于我的powershell命令。网站显示了一个命令(
vcreedist_x64.exe
)和参数列表(
/q:a…
)因此,问问你自己:如何将其与
启动流程-ArgumentList
集成?我做了:运行Invoke WebRequest-OutFile vcredit_x64.exe;\Start Process msiexec-Wait-ArgumentList'/I vcredit_x64.exe/l*v C:\vcreditlog.txt/q';\Remove Item-Force vcredit_x64.exe,但似乎没有安装。