Jump to content

1 Screenshot

About This File

..so I have to help someone and remember how to get the session ID,
then remember how to shadow. All from a command prompt. Not cool.

So I wrote this,

Is coded for Windows in English. May work in other languages too.
( as long as "qwinsta" runs, this should work )
 It now calls wtsapi32.dll

For this to work as intended, uncheck "noPrompt", or make the changes
 to the group policy, only if you know what you are doing.
( I will not aid anyone on how what, as I'm not qualified )

This is for when all works as you wish, but have to use the
 command line to shadow a user ( and everyone is in a hurry ).
This gives you a list of users to just click to help the
user on a remote session, by guiding them ( view ) or
interacting with the desktop ( control ).

I do not advise to change anything on your system, nor to use this,
but if you find it useful, then, it is a very practical utility.

  I did not post in the examples forum as is not an example worth posting.
  It grabs the text out of qwinsta Calls wtsapi32.dll
 and runs mstsc. Not a noteworthy example.


What's New in Version 0.2019.3.15

Released

Ditched the need for qwinsta.exe.
It now uses the code from https://www.autoitscript.com/forum/topic/198186-listusersessions/

What's New in Version 0.2019.3.3
Added "Close to tray". ( Pressing "control key", will close regardless of "Close to tray" ).
 Right-click to exit from the tray. Double click to reload/restore.
Removed "requireAdministrator". If you are and admin ok, else, "RunAs" will ask for admin rights.
 When you run it a second time, it will reload, without asking for rights again

What's New in Version 0.2018.12.10
Added an INI file to save the selected settings ( it's annoying when the script does not remember the settings )

What's New in Version 0.2018.12.6
Added support for Server 2003

What's New in Version 0.2018.12.5
Removed "English only" limitation as the fields may land on the same positions for other languages too.
 

 




User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

  • Similar Content

    • By argumentum
      About This File
      I use RDP a lot, and is not uncommon to run another session again, closing the prior connection that was minimized.
      The solution:  See if the window exists. If it does, restore it, else, run it.  
      And this is the support topic for RdpRunner.
      so, if you need help with this, this is the place  
      The only question that come to mind is: What is a RDP file ?, and that, is better answered by searching https://www.google.com/search?q=rdp+file
       
    • By argumentum
      I use RDP a lot, and is not uncommon to run another session again, closing the prior connection, when minimized.
      The solution?, see if the window exists. If it does, restore it, else, run it.
    • By Colduction
      Hello Guys and AutoIt Scriptwriters!🎉❤️
      I've created a script to notify to me if RDP main IP changed then send a message via Telegram bot to me
      But some of my RDP's Main IP are @IPAddress1 or @IPAddress3 or Public IP Address...
      I want to detect automatically the IP that windows client can run RDP to remotely control
      This image can help you that what i say, there are three RDP with specified IP, i want to run script in these RDP's then capture those IP's changes then notify me via Telegram bot

    • By FMS
      Hello,
      At this moment I'm trying to make a RDP tool to make multiple connections and switch between them.
      Curently I'm having troubles in making multiple connections and got some error's.
      I know why I get the error's  (trying to change a active connection) but I'm not sure how to solve this.
      Does somebody know a cleaver way to make it scalable into more connections in the same embeded window?
      Also I'm open for sugestions for making this code better
      Below the code I'm working on at the moment:
       
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #Include <GuiComboBoxEx.au3> Global $configfile = @ScriptDir & "\config.rto" Global $configarray[0][0] Global $RDP_id = False Global $RDP_name = False Global $RDP_ip = False Global $RDP_usr = False Global $RDP_dom = False Global $RDP_pass = False $Form1 = GUICreate("Form1",952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Connect", 160, 8, 75, 25) $Button2 = GUICtrlCreateButton("Disconnect", 240, 8, 75, 25) $Button3 = GUICtrlCreateButton("Button3", 320, 8, 75, 25) $oRDP = ObjCreate("MsTscAx.MsTscAx.10") $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 64, 44, 800, 600) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) GUISetState(@SW_SHOW) fetch_config() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 set_config(GUICtrlRead($Combo1)) Case $Button1 $oRDP.DesktopWidth = 800 $oRDP.DesktopHeight = 600 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $oRDP.Server = $RDP_ip $oRDP.UserName = $RDP_usr $oRDP.Domain = $RDP_dom $oRDP.AdvancedSettings2.ClearTextPassword = $RDP_pass $oRDP.ConnectingText = "Connecting to " & $RDP_ip $oRDP.DisconnectedText = "Disconnected from " & $RDP_ip $oRDP.StartConnected = True $oRDP.Connect() Case $Button2 $oRDP.Disconnect() Case $Button3 WinSetState($oRDP_Ctrl, "", @SW_HIDE) EndSwitch WEnd Func cmdkey() ;cmdkey /generic:TERMSRV/ip1 /user:dom1\usr1 /pass:pass1 EndFunc Func set_config($selected = GUICtrlRead($Combo1)) Local $found = False Local $found_id = False $RDP_id = False $RDP_name = False $RDP_ip = False $RDP_usr = False $RDP_dom = False $RDP_pass = False For $x = 1 To UBound($configarray,1) -1 If $selected = $configarray[$x][1] Then ;~ ConsoleWrite ($configarray[$x][0]& @CRLF & $configarray[$x][1]& @CRLF & $configarray[$x][2]& @CRLF & $configarray[$x][3]& @CRLF & $configarray[$x][4]& @CRLF & $configarray[$x][5]& @CRLF) $found_id = $x $found = True EndIf Next If $found Then $RDP_id = $configarray[$found_id][0] $RDP_name = $configarray[$found_id][1] $RDP_ip = $configarray[$found_id][2] $RDP_usr = $configarray[$found_id][3] $RDP_dom = $configarray[$found_id][4] $RDP_pass = $configarray[$found_id][5] Return True Else Return False EndIf EndFunc Func fetch_config() If FileExists($configfile) Then ;~ ReDim $configarray[0][0] If _FileReadToArray($configfile, $configarray , 0 , "|") Then _GUICtrlComboBox_ResetContent($Combo1) _GUICtrlComboBox_BeginUpdate($Combo1) ;~ _GUICtrlComboBox_AddString($Combo1, "") For $i = 1 To UBound($configarray,1) -1 _GUICtrlComboBox_AddString($Combo1, $configarray[$i][1]) Next _GUICtrlComboBox_EndUpdate($Combo1) _GUICtrlComboBox_SetCurSel($Combo1, 0) If set_config(GUICtrlRead($Combo1)) Then Return True Else Return False EndIf Else Return False EndIf Else If Not _FileCreate($configfile) Then Return False Else Local $LC_fileSetTime = FileSetTime($configfile, @YEAR & @MON & @MDAY , $FT_CREATED) If $LC_fileSetTime = 0 Then Return False Else Local $set_rights = Run(@ComSpec & " /c icacls " & $configfile & " /grant Users:F" , "" , @SW_HIDE) If Not $set_rights Then Return False Else Local $file = FileOpen($configfile, 1) If $file = -1 Then Return False Else FileWrite($file, "ID|name|IP|username|domain|pass" & @CRLF) FileWrite($file, "1|name1|ip1|name1|dom1|pass1" & @CRLF) FileWrite($file, "2|name2|ip2|name2|dom2|pass2" & @CRLF) EndIf FileClose($file) fetch_config() Return True EndIf EndIf EndIf EndIf EndFunc  
      edit :
      error at reuse connection :
       
      (51) : ==> The requested action with this object has failed.: $oRDP.Connect() $oRDP^ ERROR >Exit code: 1 Time: 13.73  
    • By Piotr_Hodl
      Hi guys,
       
      My post is more architecture related than the actual autoit script.
      Currently I have a java tool that makes a connection to a azure Windows VM using WINRM.
      Then I "grep" the session ID of RDP and using psexec I execute my autoit script on the session ID of the RDP (This assumes that I need to have already a RDP connection established).
      The script runs perfectly when I have a RDP session maximized/opened. If I minimize the RDP window some commands do not work, as for example the Send command.
      I do understand that it has to do with the window not being active, even though the script is executed remotely.
      https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F
       
      My goal is to be able to run the autoit scripts with no limitations, like I was running in my local machine.
       
      One important thing, all the flow is being triggered from a linux machine with no GUI. So that is why, I am using a jar file to start the winrm connection.
       
      So to sum up:
      starting server: centos with no GUI
      remote server: azure win 10
      goal: from starting server, launch autoit script that is on remote server
       
      Thanks
      Piotr
       
       
       
×
×
  • Create New...