I have the following Powershell script:
#Set up server and AC parameters
param([string]$DBServer, [string]$ACString1, [string]$AcString2, [string]$ACString3, [string]$ACString4, [string]$ACString5, [string]$ACString6, [string]$ACString7, [string]$ACString8, [string]$ACString9, [string]$ACString10)
$ACString1 = $ACString1 -replace "'", ""
$ACString2 = $ACString2 -replace "'", ""
$ACString3 = $ACString3 -replace "'", ""
$ACString4 = $ACString4 -replace "'", ""
#Set up new session object for accessing production
$sess = new-pssession -computer $DBserver
#Execute AC
#invoke-command -session $sess -ScriptBlock {param($scriptACString)& 'C:\Program Files (x86)\LexisNexis\InterAction\IAAppCol\INTIATBC.EXE' Our Personnel/Personnel Bus Addr} -args $ACString invoke-command -session $sess -ScriptBlock {param($a, $b, $c, $d, $e, $f, $g, $h, $i, $j)& 'C:\Program Files (x86)\LexisNexis\InterAction\IAAppCol\INTIATBC.EXE' $a $b $c $d $e $f $g $h $i $j} -ArgumentList($ACString1, $AcString2, $AcString3, $AcString4, $AcString5, $AcString6, $AcString7, $AcString8, $AcString9, $AcString10)
This is set up this way because the executable it calls will not function if a single or double quote is passed along with any parameter. So I pass each token separately since passing it as one parameter would result in single quotes around every token.
When executing from powershell command prompt it is successful:
PS C:\users\mp071663_e> ./executeac.ps1 stvsqld08 our personnel
When I try to execute this in SSIS I can't get it to execute successfully. Using execute process task. Configured as follows:
Executable: C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe
Arguments: -ExecutionPolicy ByPass -command ". 'C:\Users\mp071663_e\ExecuteAC.ps1' stvsqld08 Our Personnel"
I've also tried the following:
Arguments: -ExecutionPolicy ByPass -command ". 'C:\Users\mp071663_e\ExecuteAC.ps1' 'stvsqld08' 'Our' 'Personnel'"
Arguments: -ExecutionPolicy ByPass -command ". 'C:\Users\mp071663_e\ExecuteAC.ps1' -$DBServer 'stvsqld08' -$ACString1 'Our' -$ACString2 'Personnel'"
Arguments: -ExecutionPolicy ByPass -command ". 'C:\Users\mp071663_e\ExecuteAC.ps1' -$DBServer stvsqld08 -$ACString1 Our -$ACString2 Personnel"
Any help is greatly appreciated.
Possibly a 32/64 bit issue? SSIS packages run from Visual Studio run as a 32 bit app, does your script work in 32 bit PowerShell?
Also have you set the WorkingDirectory?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.