0% found this document useful (0 votes)
18 views2 pages

AutoIt Script for SQL Server Login

The document provides instructions on downloading AutoIt and using the SciTE editor to create a script for launching SQL Server Management Studio (SSMS) with specific authentication details. It includes steps for setting the file path, sending control commands to the SSMS window, and compiling the script into an executable. Additionally, it outlines how to create a launcher in Secret Server to manage the SSMS process with parameters for server, username, and password.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

AutoIt Script for SQL Server Login

The document provides instructions on downloading AutoIt and using the SciTE editor to create a script for launching SQL Server Management Studio (SSMS) with specific authentication details. It includes steps for setting the file path, sending control commands to the SSMS window, and compiling the script into an executable. Additionally, it outlines how to create a launcher in Secret Server to manage the SSMS process with parameters for server, username, and password.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Download AutoIt and Editor:

[Link]

Open SciTE:

Copy and Paste the following Script

Script:

;set filepath of [Link]

$Path = "C:\Program Files (x86)\Microsoft SQL Server Management Studio


18\Common7\IDE\[Link]"

;execute [Link]

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]")

Save it on desktop

SciTE -> Tools -> Compile -> Tools -> Go

Open “Compile Script to .exe (x64)”

Source -> Browse -> Select Script -> Convert -> Copy destination path

Go to Secret Server:

Create Launcher:

Record Additional Processes -> [Link]

Process Name -> Paste Destination Path

Process Arguments -> "$Server" "$Username" "$Password"

Templates

You might also like