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

Install AutoIT on your user’s
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

 Copy the attached
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 launcher with the following settings (note double quotes around variables):

 

 

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

By Jon

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

%d