gcriaco Posted April 9, 2020 Share Posted April 9, 2020 I am looking for a Script with which i can automate the RDP to a Windows10 PC. The examples based on RDP Embedded Sessions ("MsTscAx.MsTscAx.x / MsRDP.MsRDP.x" - http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx) from several posts are working just in case the target machine is running IIS. I'm wondering if it's possible to use these ActiveX or other features for PCs without IIS too. Any help? Thanks Peppe Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 9, 2020 Moderators Share Posted April 9, 2020 Please check your link, is not working for me. "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 More sharing options...
FrancescoDiMuro Posted April 9, 2020 Share Posted April 9, 2020 @JLogan3o13 Try this one (without the round parentheses at the end) removed Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
gcriaco Posted April 9, 2020 Author Share Posted April 9, 2020 Correct MS link: https://docs.microsoft.com/it-it/windows/win32/termserv/imsrdpclient-interface?redirectedfrom=MSDN This is an old thread related to ActiveX RDP: Link to comment Share on other sites More sharing options...
gcriaco Posted April 14, 2020 Author Share Posted April 14, 2020 This "quick and dirty" workaround works: local $iPid = run("mstsc.exe /v:IP /public", "", @SW_HIDE) WinWaitActive("Sicurezza di Windows", "", 3) Sleep(1000) Send("User") Sleep(500) send("{TAB}") Sleep(500) send("Password") Sleep(500) send("{ENTER}") Exit If somebody knows how to connect to Win10 PCs via ActiveX please let me know. Otherwise, maybe this code could be useful to someone. Regards Peppe Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 14, 2020 Share Posted April 14, 2020 @gcriaco Did you try the script in the post you provided? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
gcriaco Posted April 15, 2020 Author Share Posted April 15, 2020 Yes, of course. You have to substitute IP, User and Password with your data. Moreover, "Sicurezza di Windows" is the RDP Window Title (italian Windows O.S. version): You have to sustitute "Sicurezza di Windows" with the correct title of the window. As I already said, it's just a workaround, but unfortunately I'm not able to use the RDP ActiveX objects to connect to PCs (just IIS servers) Link to comment Share on other sites More sharing options...
BigDaddyO Posted April 15, 2020 Share Posted April 15, 2020 This one works for me for RDP connection, but you have to have your credentials stored in cmdkey for the specified target machine: TERMSRV/TargetName ShellExecute(@SystemDir & "\mstsc.exe", "/v:" & $sServer & " /w:1024 /h:768") ;Launch the RDP session Link to comment Share on other sites More sharing options...
gcriaco Posted April 17, 2020 Author Share Posted April 17, 2020 Found the solution (described here: stackoverflow) I need to add the following step to ptrex old topic: $oRDP.AdvancedSettings8.EnableCredSspSupport = true Script example: expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> $host = "IP Address" ;<<<<<<< enter here the host name or ip address ;Remote Desktop ActiveX Control Interfaces -> http://msdn.microsoft.com/en-us/library/aa383022(v=VS.85).aspx $hGUI = GUICreate("RDP Embedded Sessions", 952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $oRDP = ObjCreate("MsTscAx.MsTscAx") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 64, 44, 800, 600) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) $oRDP.DesktopWidth = 1366 $oRDP.DesktopHeight = 768 $oRDP.Fullscreen = 768 $oRDP.ColorDepth = 32 $oRDP.AdvancedSettings2.RedirectDrives = True ; Sollen die Laufwerke mitgenommen werden $oRDP.AdvancedSettings2.RedirectPrinters = False ; Sollen die Drucker mitgenommen werden $oRDP.AdvancedSettings2.RedirectPorts = False ; Ports wie LPT1 etc $oRDP.AdvancedSettings2.RedirectSmartCards = False ; SmartCards für Authentifizierung $oRDP.AdvancedSettings2.EnableAutoReconnect = False $oRDP.AdvancedSettings2.allowBackgroundInput = False $oRDP.AdvancedSettings2.ConnectionBarShowRestoreButton = False $oRDP.AdvancedSettings3.SmartSizing = True $oRDP.AdvancedSettings5.AudioRedirectionMode = 0 $oRDP.AdvancedSettings2.ClearTextPassword = "Password" ; <<<<<<< enter here the user password $oRDP.AdvancedSettings8.EnableCredSspSupport = true $oRDP.Server = $host $oRDP.UserName = "Username" ;<<<<<<< enter here the user name $oRDP.Domain = "domain" ;<<<<<<< enter here the domain name $oRDP.ConnectingText = "Connecting to " & $host $oRDP.DisconnectedText = "Disconnected from " & $host $oRDP.StartConnected = True $oRDP.Connect() GUISetState(@SW_SHOW, $hGUI) ;~ ConsoleWrite($oRDP.GetErrorDescription() & @CRLF) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $oRDP.Disconnect() Exit EndSwitch WEnd Hope this post is useful to someone else. regards Peppe FrancescoDiMuro, caramen and SenfoMix 2 1 Link to comment Share on other sites More sharing options...
maniootek Posted November 20, 2023 Share Posted November 20, 2023 Is there any way to automate rdp login without creating gui? I want to bring back the restore button. Link to comment Share on other sites More sharing options...
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