Start VPN from SSIS package?

六月ゝ 毕业季﹏ 提交于 2019-12-06 09:33:40

I solved it! I needed to add a wait between package1 (starting the VPN) and package2 (doing the import) After setting up the VPN, package1 was made to wait 5 secs before continuing. Now everything works swell :)

SO: Package 1 containg a VB scriptask for starting up the (existing) VPN:

Dim VPNConnectionName As String = "MyVPN"
Dim VPNlogin As String = "MyUser"
Dim VPNPassword As String = "MyPass"

Shell("RASDIAL " & Chr(34) & VPNConnectionName & Chr(34) & " " & VPNlogin & " " & VPNPassword, vbNormalFocus)
        '
System.Threading.Thread.Sleep(5000)
Dts.TaskResult = ScriptResults.Success

Then from package1 call package 2 for the actual import

And a VB scripttask for closing the VPN:

Dim VPNConnectionName As String = "MyConnection"

Shell("RASDIAL " & Chr(34) & VPNConnectionName & Chr(34) & " /DISCONNECT", vbNormalFocus)
            '
Dts.TaskResult = ScriptResults.Success
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!