PDA

View Full Version : [SOLVED] Check if Plink.exe is active



paulked
09-19-2019, 06:24 AM
Hi

I use Plink to make a secure shell connection to our website to enable me to access our database.



Sub PlinkConnect()
Dim Prog As String, Arg As String
Prog = "C:\Program Files\Putty\plink.exe"
Arg = " -ssh Fringe -pw *********"
Call Shell(Prog & Arg, vbMinimizedFocus)
Application.Wait (Now + TimeValue("00:00:05"))
SendKeys "{ENTER}", True
End Sub


How can I detect if the tunnel is open so I don't have more than one connection at a time?

paulked
10-01-2019, 11:12 AM
I couldn't find out how to detect if the database is connected, so I have to check if Plink is running with



Dim objList As Object
Set objList = GetObject("winmgmts:").ExecQuery("select * from win32_process where name='plink.exe'")
If objList.Count > 0 Then Exit Sub


and hope it's connected!