我正在尝试将SSIS变量传递到通过SSIS中的Process Task运行的PowerShell脚本,即使使用SSIS 2008,如果这有任何区别
这是使用PowerShell脚本的副本,当使用硬编码值执行时,它运行正常
param ([string]$SourceServer, [string]$DestinationServer, [string]$Filename )
$SourceServer = "SERVERA"
$DestinationServer = "SERVERB"
$Filename = "DbNAME.mdf"
$SourcePath = "\D$\Data\"
$DestinationPath = "\D$\Data\Backups\"
$Source = '\\' + $SourceServer + $SourcePath + $Filename
$Destination = '\\' + $DestinationServer + $DestinationPath + $Filename
copy-item -path $Source -destination $Destination -verbose
Run Code Online (Sandbox Code Playgroud)
如果我对param进行硬编码,我可以让PowerShell脚本正常运行,但是只要我将其更改为变量,变量值就不会被传递
在流程任务中,这是可执行文件
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
Run Code Online (Sandbox Code Playgroud)
正确构建参数字符串,因此我知道传入的变量值
-ExecutionPolicy Unrestricted -File "C:\Qarefresh.ps1" "DbaseA.mdf"
Run Code Online (Sandbox Code Playgroud)
这是表达式的代码
"-ExecutionPolicy Unrestricted -File \"" + "C:\\Qarefresh.ps1\" \"" + @[User::QA_FileName] + "\""
Run Code Online (Sandbox Code Playgroud)
我对PowerShell比较新,所以如果我错过了一些基本的东西,我会道歉,但我很接近用这个来拉我的头发
提前感谢您提供的任何帮助