Monday, March 26, 2012

Exec Process Task problem

I am trying to use a variable in an Execute Process Task

Here is my code that I use to set the variable and it works and has the right information:

Public Sub Main()

Dim serverNamePart As String = Mid(CStr(System.Environment.MachineName()), 1, 5)

Dts.Variables.Item("gvServerName").Value = (CStr(System.Environment.MachineName()))

Select Case serverNamePart

Case "ATCDE" 'Development server

Dts.Variables.Item("gvAppServer").Value = "ATCDEVRPNAPP01"

Case "ATCIN" 'Intergration server

Dts.Variables.Item("gvAppServer").Value = "ATCINTRPNAPP01"

Case "ATCDE" 'Development server

Dts.Variables.Item("gvAppServer").Value = "ATCQARPNAPP01"

Case "LTC1P" 'Development server

Dts.Variables.Item("gvAppServer").Value = "LTC1RPNAPP01 LTC1RPNAPP02 LTC1RPNAPP03 LTC1RPNAPP04"

End Select

' MsgBox(Dts.Variables.Item("gvServerName").Value)

MsgBox(Dts.Variables.Item("gvAppServer").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

On my Execute Process task I have User::gvAppServer as my StandardInputVariable but when I execute the task I get

[Execute Process Task] Error: In Executing "D:\RPNUtility\bin\AutoTransmitCall.exe" "" at "", The process exit code was "1" while the expected was "0".

If I take out the StandardInputVariable and hard code the value in Arguments it works. What am I doing wrong?

Phil, I believe you want to parameterize your "Arguments" property rather than your StandardInputVariable property. Use the Expressions page of the Execute Process Editor to use your gvAppServer variable for Arguments.

Your StandardInputVariable would be used for data that is processed by an executable, rather than a parameter for it.

|||That looks like it worked. Thanks.

No comments:

Post a Comment