Wingens Posted August 20, 2020 Posted August 20, 2020 Hi, i am trying to create a easy way for our employees to login to servers using RDP. This is the first stage later on the username and passwords will be automaticly entered when choosing the server. I have found this code on the forum and am trying to get in to work however it is not connecting. Perhaps I am missing something here? Source: https://www.autoitscript.com/forum/topic/133217-rdp-session-in-autoit-gui/ Post: ByteSniper expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #RequireAdmin Opt("GUIOnEventMode", 1) $hGUI = GUICreate("RDP", 1401, 801, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "hGUIClose") $Connect = GUICtrlCreateButton("Connect", 1272, 16, 115, 33, 0) GUICtrlSetOnEvent(-1, "ConnectClick") GUICtrlCreateLabel("Username:", 1272, 130) $USER = GUICtrlCreateInput("", 1272, 150, 115, 23) GUICtrlCreateLabel("Password:", 1272, 180) $Password = GUICtrlCreateInput("", 1272, 200, 115, 23, $ES_PASSWORD) ;GUICtrlSetOnEvent(-1, "ConnectClick") $oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 4, 4, 1232, 792) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) GUICtrlSetStyle($oRDP_Ctrl , $WS_EX_STATICEDGE) $oRDP.DesktopWidth = 1240 $oRDP.DesktopHeight = 800 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $serveur = GUICtrlCreateCombo("", 1272, 50, 120, 23) GUICtrlSetData(-1, "", "") GUICtrlSetFont(-1, 9, 800, 0, "Courier new") ;GUICtrlSetOnEvent(-1, "ConnectClick") GUISetState(@SW_SHOW) Call("Load_srv") While 1 Sleep(100) WEnd Func ConnectClick() $GO = 1 $host = GUICtrlRead($serveur,1) ;<<<<<<< enter here the host name or ip address $Name = GUICtrlRead($USER) $Pass = GUICtrlRead($Password) If $host = "" Then MsgBox(4096, "", "Please choose a server.") $GO = 0 EndIf If $Name = "" Then MsgBox(4096, "", "Please fill in a username.") $GO = 0 EndIf If $Pass = "" Then MsgBox(4096, "", "Please fill in a password.") $GO = 0 EndIf If $GO = 1 Then $oRDP.Server = $host $oRDP.UserName = $Name $oRDP.Domain = "" $oRDP.AdvancedSettings2.ClearTextPassword = $Pass $oRDP.ConnectingText = "Connecting to " & $host $oRDP.DisconnectedText = "Disconnected from " & $host $oRDP.StartConnected = True $oRDP.connect() EndIf EndFunc func Load_srv() $var = IniReadSection(@ScriptDir & "\RDP_QC.ini","Serveurs") For $i = 1 To $var[0][0] ; MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) GUICtrlSetData($serveur,$var[$i][1]) Next endFunc Func hGUIClose() exit EndFunc [serveurs] Server1 = 192.168.2.2 Server2 = Server2 Server3 = Server3
Earthshine Posted August 20, 2020 Posted August 20, 2020 It sounds like a security nightmare and it’s already easy for employees to use already Use rdp. Rdp is a no brainer to use So I don’t even see the point of automating anything My resources are limited. You must ask the right questions
Wingens Posted August 20, 2020 Author Posted August 20, 2020 Automating the credentials, when we replace a workstation or a new employee logs in he needs to input the credentials. From autoit i would be able to send the credentials.
Earthshine Posted August 20, 2020 Posted August 20, 2020 (edited) new employees should be assigned credentials that work across the network. I still don't get it. Domain users should use their own, and never anyone elses. what is this going to save the user? 2 seconds? anyway, best of luck rdp can create a shortcut already and have it ALWAYS ask for credentials. it should be installed on every new workstation, all the links to servers they need, and they just add their credentials to each when they log in. Edited August 20, 2020 by Earthshine My resources are limited. You must ask the right questions
Wingens Posted August 21, 2020 Author Posted August 21, 2020 Please I am not here to discus our companies choise. Is there a way to get this to work?
Moderators JLogan3o13 Posted August 21, 2020 Moderators Posted August 21, 2020 @Wingens why are you reinventing the wheel, rather than using Remote Desktop Connection Manager? Then, if you need to add features you can just automate the RDCM. Earthshine 1 "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!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now