我想从具有参数的PowerShell脚本调用“PS App Deployment Toolkit”包(Link)。PowerShell启动过程与泼溅
提到的“PS应用程序部署工具包” - 包是一个powershell脚本,我想用参数调用。 (从.ps1调用.ps1)
我想使用splatting作为参数。
我想等待脚本结束。
我想从脚本中获取退出代码。
这里是我的代码,这是行不通的:
$PSADToolKitInstallWrapper = "C:\Temp\MyPackage\PS-AppDeploy.ps1"
$PSADToolKitParameters = @{
"DeploymentType" = "Uninstall";
"DeployMode" = "Interactive";
"AllowRebootPassThru" = $True;
"TerminalServerMode" = $False;
"DisableLogging" = $False;
}
$InstallStatus = Start-Process -FilePath "PowerShell.exe" -ArgumentList $PSADToolKitInstallWrapper @PSADToolKitParameters -Wait -PassThru
Write-Host "Exit-Code: $($InstallStatus.ExitCode)"
此线将正常工作,但我想在上面的例子中,设置参数,如:
$InstallStatus = Start-Process -FilePath "PowerShell.exe" -ArgumentList "$PSADToolKitInstallWrapper","-DeploymentType Install -DeployMode Silent -AllowRebootPassThru -TerminalServerMode" -Wait -PassThru
请你帮助我得到这个工作?
谢谢!
这不是在你的例子中溅起。如果你摆脱了'@ PSADToolKitParameters',它将工作 – TheIncorrigible1
...和@InIncorrigible1是正确的。您的示例不包含溅射。查看我的答案,了解如何使用溅射。 –