Jump to content

AutoIt Remote Desktop Connection


Recommended Posts

  • Moderators

If you want more than just to execute mstsc, say you need to connect to multiple machines in a business context, you could also embed the rdp client into a GUI. Something like this (barebones example):

#include <GUIConstants.au3>
 
$oRDP = ObjCreate("MsTscAx.MsTscAx")
$mGUI = GUICreate("Embedded RDP", 740, 480, -1 , -1)
$GUIActiveX = GUICtrlCreateObj($oRDP, 10, 10, 620, 460)
$comp1 = GUICtrlCreateRadio("PC 1", 635, 50, 50, 30)
$comp2 = GUICtrlCreateRadio("PC 2", 635, 90, 50, 30)
$comp3 = GUICtrlCreateRadio("PC 3", 635, 130, 50, 30)
$go = GUICtrlCreateButton("Go", 635, 440, 40, 30)
GUISetState()
 
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
  Case $msg = $go
   Select
    Case GUICtrlRead($comp1) = 1
     $oRDP.Server = "Computer1"
     $oRDP.Domain = "DOMAIN"
     $oRDP.UserName = "USERNAME"
     $oRDP.Connect()
    Case GUICtrlRead($comp2) = 1
     $oRDP.Server = "Computer2"
     $oRDP.Domain = "DOMAIN"
     $oRDP.UserName = "USERNAME"
     $oRDP.Connect()
    Case GUICtrlRead($comp3) = 1
     $oRDP.Server = "Computer3"
     $oRDP.Domain = "DOMAIN"
     $oRDP.UserName = "USERNAME"
     $oRDP.Connect()
   EndSelect
    EndSelect
WEnd
 
GUIDelete()
 
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...