【发布时间】:2018-11-30 15:58:11
【问题描述】:
我有下面的 Powershell 脚本,它正在检查文件是否存在并被锁定。这是通过执行流程任务在 SSIS 中调用的。但是,我想将此结果作为“真”或“假”传递给 SSIS 中的变量(称为“Log_Result”,然后我可以将其用于优先约束。我将如何修改脚本以传递变量的真假?
# checks if the file exists and then if the file is locked
$file = "\\xxxx\xxxx\xxxxxxx\test.log"
if (Test-Path -path $file)
{
try { [IO.File]::OpenWrite($file).close();exit 0 } catch { exit 999}
}
else
{
exit 999
}
【问题讨论】:
-
您是通过
Execute Process Task调用PS 脚本吗?如果没有,脚本是如何在 SSIS 中运行的? -
是 - 根据编辑
-
您可以将
Execute Process Task配置为使用StandardOutputVariable。您可能还必须将FailTaskIfReturnCodeIsNotSuccessValue设置为False。
标签: powershell ssis