AutoIT
is basically a way of automating stuff in the windows GUI and has lots of uses.
Here is an working launcher and example script for SSMS with SQL Authentication since ssms.exe >v.18.0 no longer supports command line
arguments. All steps:
- Install AUTO IT on to the RDS server
- Create attached scrtipt and compile into an executable
- Create security template and custom launcher to pass credentials and host information to the AutoIt script executable.
Install AutoIt
machines who will be using these launchers. If using session connector install
on the RDS server: (https://ift.tt/3zn9sCG)
Download url : https://ift.tt/3zn9sCG
Create and Compile AutoIt Script
script and open with SciTE (built in Auto IT script editor, convert to .au3)
Below is the example script to launch SSMS.exe and complete SQL
Auth :
;Thycotic ssms.exe with sql credential launcher script
;set filepath of ssms.exe
$Path = "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"
;execute ssms.exe
ShellExecute($Path)
;Wait for the 'connect to server' window to appear
WinWaitActive("Connect to Server", "", 0)
;set auth mode to SQL authenticaiton
ControlSend("Connect to Server" , "" , "[NAME:comboBoxAuthentication]", "[NAME:SQL]")
;set server instance to servername passed from Secret Server launcher in cmd line parameter 1
ControlSetText("Connect to Server", "", "[NAME:serverInstance]", $CmdLine[1],1)
;set username to username passed from Secret Server launcher in cmd line parameter 2
ControlSetText("Connect to Server", "", "[NAME:userName]", $CmdLine[2],1)
;set password to password passed from Secret Server launcher in cmd line parameter 3
ControlSetText("Connect to Server", "", "[NAME:password]", $CmdLine[3],1)
;reactivate the connect to server window, required for the click of buttons within the window
WinActivate ("Connect to Server")
;click the connect button
ControlClick("Connect to Server", "", "[NAME:connect]")
Compile (go to Tools on toolbar and select Compile)
Save .exe to a location accessible to all users
(c:\autoit in my case)
Create Launcher
Create a
regular session connector launcher and use the above child launcher
Create a new secret template and
pass servername, username and password.
from Blogger http://blog.51sec.org/2021/07/using-autoit-to-create-launchers-ssms.html