【问题标题】:SSIS calling Powershell - the term is not recognizedSSIS 调用 Powershell - 无法识别该术语
【发布时间】:2021-05-29 00:06:18
【问题描述】:

我正在使用 SQL Server 2014 和 SSIS。我想从 Execute Process Task 调用 Powershell 脚本文件,但它一直失败。如果我打开 Powershell ISE 并执行 File > Open,我的脚本运行良好,所以问题不在于实际的 .ps1 文件。

这是我的执行过程任务——显然在现实世界中使用了正确的服务器名\路径:

所以,我退后一步,打开 Powershell 并将 SSIS 中的参数粘贴到:

-F "\\servername\path\myPSFile.ps1"

但我得到了错误:

-F : 术语“-F”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。

然后我尝试了:

-File "\\servername\path\myPSFile.ps1"

但是得到了:

-File : 术语“-File”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。

然后我尝试了:

-ExecutionPolicy Unrestricted -command "\\servername\path\myPSFile.ps1"

但收到错误:

The term ExecutionPolicy is not recognized as the name of a cmdlet, function, script file, or operable program.

然后我跑了:

Get-Module -All

我安装的只是:

Binary \ Script \ Manifest

我需要安装另一个模块吗?

我错过了什么?

【问题讨论】:

  • 能把执行流程任务的详细信息发过来看看吗?

标签: sql-server powershell ssis


【解决方案1】:

看来Arguments设置值需要调整如下:

-command "\\servername\path\myPSFile.ps1"

另外,需要将 ExecutionPolicy 指定为 Unrestricted。

所以,最终的参数如下:

-ExecutionPolicy Unrestricted -command "\\servername\path\myPSFile.ps1"

请查看此链接了解所有详情:How to Execute a PowerShell Script from an SSIS Package

【讨论】:

  • 对不起,类似的错误,我已经更新了原帖
猜你喜欢
  • 2020-03-03
  • 2015-07-30
  • 2016-05-29
  • 2020-02-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-07
  • 2012-05-11
相关资源
最近更新 更多