Require Myserver ping OK/NOT status on My connectivity tool

ganesh_6663

New Member
Joined
Jul 15, 2021
Messages
33
Office Version
  1. 2016
Platform
  1. Windows
Crated small tool to login Myserver using putty , but first need to login Jump server from Jump server we can login Myserver .
Required Myserver ping status on my tool , if ping is OK then login to server or "PING NOT OK" msg and stop micro.

login tool download link..........


VBA Code:
Sub PUTTYSM()
Dim PuttyPID As Double
Dim PuttyHwnd As LongPtr
Dim serverName As String
Dim username As String
Dim password As String
Dim enbpass As String
Dim Jumpserver As Variant
Dim myserver As Variant
myserver = UserForm1.Reg2.Value
Jumpserver = UserForm1.Reg3.Value

 username = "demo"
 password = "password"
 mainserverpass = "password"


PuttyPID = Shell("D:\putty.exe -ssh  " & Jumpserver, vbNormalFocus)   'CHANGE PATH TO .EXE
    PuttyHwnd = GetWindowHandle(CLng(PuttyPID))
    If PuttyHwnd <> 0 Then
   
   
    'Login jump server
        Application.Wait DateAdd("s", 2, Now)
        SendChars PuttyHwnd, username & vbCr
        Application.Wait DateAdd("s", 2, Now)
        SendChars PuttyHwnd, password & vbCr
        
    'Login main server
        Application.Wait DateAdd("s", 1, Now)
        SendChars PuttyHwnd, "ssh demo@" & myserver & vbCr
        Application.Wait DateAdd("s", 1, Now)
        SendChars PuttyHwnd, mainserverpass & vbCr

    End If
   
End Sub
--------------------------------------------------------------------------------------------------
Sub PUTTYSMPING()

Dim PuttyPID As Double
Dim PuttyHwnd As LongPtr
Dim serverName As String
Dim username As String
Dim password As String
Dim enbpass As String
Dim Jumpserver As Variant
Dim myserver As Variant
myserver = UserForm1.Reg2.Value
Jumpserver = UserForm1.Reg3.Value

 username = "demo"
 password = "password"

PuttyPID = Shell("D:\putty.exe -ssh  " & Jumpserver, vbNormalFocus)   'CHANGE PATH TO .EXE
    PuttyHwnd = GetWindowHandle(CLng(PuttyPID))
    If PuttyHwnd <> 0 Then
   
    'Login jump server
        Application.Wait DateAdd("s", 2, Now)
        SendChars PuttyHwnd, username & vbCr
        Application.Wait DateAdd("s", 2, Now)
        SendChars PuttyHwnd, password & vbCr
        
    'Ping main server
        Application.Wait DateAdd("s", 1, Now)
        SendChars PuttyHwnd, "ping " & myserver & vbCr
        Application.Wait DateAdd("s", 1, Now)
     

    End If
End Sub

PING STATUS.JPG
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
created small tool to login Myserver using putty , but first need to login Jump server from Jump server we can login Myserver .
Required Myserver ping status on my tool , if ping is OK then login to server or "PING NOT OK" msg and stop micro.
Please suggest .......
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,972
Members
448,933
Latest member
Bluedbw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top