locked
Calling remote bat file from SSIS package RRS feed

  • Question

  • Hi

    i have to call a bat file in another server from my local machine.  BAT file may not be in the share folder.

     

    Dim

     

    options As New System.Management.ConnectionOptions

     

    Dim path As New System.Management.ManagementPath("\\" & strMachineName & "\root\cimv2:Win32_Process")

     

     

    Dim scope As New System.Management.ManagementScope(path, options)

     

    Dim opt As New System.Management.ObjectGetOptions()

     

     

    Dim classInstance As New System.Management.ManagementClass(scope, path, opt)

     

     

    Dim inParams As System.Management.ManagementBaseObject = classInstance.GetMethodParameters("Create")

     

     

    "CommandLine") = strCommand' Execute the method and obtain the return values.

     

    Dim outParams As System.Management.ManagementBaseObject = classInstance.InvokeMethod("Create", inParams, Nothing)

     

     

    Return CStr(outParams("returnValue")) '& " Process ID: {0}" & CStr(outParams("processId"))

    For calling a remote VBScript, i used "cscript c:\log.vbs" in the place of strCommand.  Its working fine.

    For callinf=g the bat file i used "wscript.shell C:\log.bat".  It didn't work

    From the remote VBScript i tried to call the bat file.  The vbscript failed to invoke bat file.

    Can anyone give me a solution?

     

    inParams(

     

     

    scope.Connect()

     

     

    options.Username = strUserName

    options.Password = strPassword

     

    Friday, November 26, 2010 4:36 AM

Answers

  • Dear Customer,

       I'm very sorry you have a wrong place posted. Your issue was not appears to be a relate "Fix it Center(Mr.Fix it)". So I suggest you post your issue to a correct forum. That you can get the right solution soon. Thanks for your understanding! 
    If I misunderstood you,please let me know. 

    Please Mark as Answered If this is helpful Or Un-Mark as Answered if it is not helpful.

    Best Regards,
    Yan Jun
    Microsoft Online Community Support

    • Marked as answer by Fafafaalex Friday, November 26, 2010 6:12 AM
    Friday, November 26, 2010 6:09 AM