SSH session from visio sheet

D

dennis

Hi group,

first I'm not very familar with visio.
I'm a network engineer and would like to draw a visio sheet. Also it
should be possible to make a ssh/telnet session from a symbol (router,
switch) to the corresponding system...
Any help for me ?

thx

Dennis
 
A

Al Edlund

I call this from an event handler.

al



'
'
'
Public Sub SSHToTarget(ByRef visWin As Visio.Window, _
ByVal strShape As String)

On Error GoTo ErrHandler

Dim visPage As Visio.Page
Dim visShapes As Visio.Shapes
Dim visShape As Visio.Shape
Dim visCell As Visio.Cell
Dim shellWin As Object
Dim strCommand As String
strCommand = "C:\Program Files (x86)\VanDyke
Software\SecureCrt\securecrt "

Set visPage = visWin.Page
Set visShapes = visPage.Shapes
Set visShape = visShapes.Item(strShape)
' can we determine the rules appropriate
' if there get ip address if not get out
If visShape.CellExists("prop.compIpAddress", False)
Then
Set visCell =
visShape.Cells("prop.compIpAddress")
strCommand = strCommand & visCell.ResultStr("")
Else
MsgBox ("couldn't find compIpAddress custom
property")
Exit Sub
End If

' create the script shell environment
Set shellWin = CreateObject("wscript.shell")

' now execute the command that we built
'Debug.Print "shellwin start"
DoEvents
shellWin.Run strCommand
DoEvents
Exit Sub

ShellCommand:
'Debug.Print "shell start"
Shell strCommand, vbNormalFocus
'Debug.Print "shell start"
DoEvents
Exit Sub
ErrHandler:
Dim myErr As ErrObject
Set myErr = Err

If Err.Number = -2147024894 Then
Debug.Print "shellwin failed"
GoTo ShellCommand
End If

Debug.Print "ssh " & Err.Description


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top