Ceci est une partie de mon script pour l'installation d'ADFS. Assez simple, mais il semble que Start-Process analyse les commutateurs de façon amusante. Y a-t-il quelque chose qui me manque?L'installation d'ADFS génère un "paramètre nul"
write-host "Installing ADFS - process should take 30-45 seconds"
$installtime=get-date -uformat "%Y_%h_%d_%H_%M"
$logfile="$pwd\adfssetup_$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}
Si j'exécutons le script ci-dessus, je reçois le texte suivant dans un fichier journal:
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)
Si j'exécute exactement la même commande manuelle (à partir de la sortie de write-host), tout fonctionne très bien .
Des idées? Merci.
Pas de réponse ici. Laisse deviner ... dans $ pwd il y a un espace blanc dans le chemin? – JPBlanc