using rdp in a visio diagram

J

John Petralia

How can I Insert a RDP command into a visio diagram shape. I want to click on
a server and have it rdp to that server
 
A

Al Edlund

consider something like this (it looks for an ipaddress in a shape data
field called 'compIpAddress'

al



'
' open a terminal services session from a winshell to the remote
'
Public Sub TermServeToTarget(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 ' create a variable for the script shell
Dim strCommand As String
strCommand = "c:\windows\system32\mstsc.exe /v:"

Set visPage = visWin.Page
Set visShapes = visPage.Shapes
Set visShape = visShapes.Item(strShape)

' 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("")
' have to change the /console to /admin to
support srv2008
' should work for everyone else as well
strCommand = strCommand & " /admin"
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
shellWin.Run (strCommand)

Exit Sub

ErrHandler:
Debug.Print "Terminal server " & 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