这是我安装ADFS脚本的一部分。相当简单,但StartProcess似乎以一种有趣的方式解析开关。我有什么东西不见了吗?
write-host "Installing ADFS - process should take 30-45 seconds"
$installtime=get-date -uformat "%Y_%h_%d_%H_%M"
$logfile="$pwdadfssetup_$installtime.log"
$ADFSInstall = "AdfsSetup.exe"
$ADFSInstallParams = /quiet /logfile +$logfile
Start-Process $ADFSInstall $ADFSInstallParams -wait
if ({gc -path $logfile | select-string -pattern "AD FS 2.0 is already installed on this computer"} -eq $null){write-host -ForegroundColor Cyan "ADFS Installed"} Else{write-host -ForegroundColor "There was an error Installing ADFS, please check the log file: $logfile;break}
如果我执行上面的脚本,我会在日志文件中得到以下内容:
Microsoft.IdentityServer.Setup Error: 5124 : 6 [ 2070099085 ]: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) at Microsoft.IdentityServer.Setup.Diagnostics.TraceLog.WriteLine(TraceEventType eventType, String msg, Object[] args)
如果我手动执行完全相同的命令(从写主机的输出),一切都很好。
Any ideas? Thank you.