Previous Topic: The SSH Device XML FileNext Topic: Registry Entries


The SAM Automatic Login Application Visual Basic Script

The SAM automatic login application uses Visual Basic scripts to enable an automatic login to users. You can customize the Visual Basic scripts to create new login applications or modify existing login applications.

The SAM automatic login application script contains variables that the ActiveX replaces with values when downloaded to the client machine from the Enterprise Management Server. The Enterprise Management Server processes the scripts and replaces the keywords with values. The ActiveX then executes the script on the client machine.

The SAM automatic login application scripts are located in the following directory:

JBOSS_HOME/server/default/deploy/IdentityMinder.ear/config/sso_scripts

Elements

The SAM login application script contains the following keys:

#host#

Specifies the endpoint name that the user automatically logs in to.

#username#

Specifies the checked out privileged account.

#password#

Specifies the privileged account password to check-out.

#userdomain#

(Active Directory) Specifies the privileged account domain name.

#isActiveServletUrl#

Specifies the URL that the ACLauncher ActiveX uses to check for an account password check-in event.

#CheckinUrl#

Specifies the URL that the ACLauncher ActiveX uses to check in the account password in case the user logged out of the endpoint.

#Owner#

Specifies the account owner name.

Note: If the attribute is not set for the account, then the key specifies the attribute of the endpoint that the account belongs to.

#Department#

Specifies the department name.

Note: If the attribute is not set for the account, then the key specifies the attribute of the endpoint that the account belongs to.

#SessionidUrl#

Specifies the URL that the ACLauncher ActiveX uses to send recorded session ID if the session is recorded in ObserverIT Enterprise.

#CustomInfo1...5#

Specifies the account-specific attribute. You can specify up to five custom account-specific attributes.

Note: If the custom attributes are not set for accounts, then the keys specify attributes of the endpoint the account belongs to.

The following is a snippet of the SAM automatic login application script:

Set pupmObj = CreateObject("ACLauncher.ACWebLauncher")
hwnd = pupmObj.LauncheRDP("#host#", "#userDomain#\#userName#", "#password#")
' Set window close event
pupmObj.SetWindowCloseEvent(hwnd)
' Set server checkin event
pupmObj.SetServerCheckinEvent("#isActiveServletUrl#")
' Wait until one of the events signaled
rc = pupmObj.WaitForEvents()
If rc = 1 Then 'user has closed the window - notify the server side
	pupmObj.SendCheckinEvent("#CheckinUrl#")
ElseIf rc = 2 Then 'timeout elapsed - close the window
    call pupmObj.CloseWindow(hwnd, 0)
ElseIf rc = 3 Then 'the account was checkedin at the server side - close the window
    call pupmObj.CloseWindow(hwnd, 120)
End If

Structure

The SAM automatic login application script structure is as follows:

To record the login application session, add recording instructions to the script, as follows:

Methods

The ACLauncher ActiveX uses the following methods:

LauncheRDP  (BSTR  bsHostName, BSTR bsUserName, BSTR  bsPassword,  VARIANT *phWindow);

Launch the remote desktop session with the input credentials and return the remote desktop window handle

Example: Dim test Set test = CreateObject("ACLauncher.ACWebLauncher") Hwnd = test.LauncheRDP("hostname.com", "hostname\administrator", "password")

LaunchePUTTY   (BSTR bsHostName,  BSTR bsUserName, BSTR bsPassword,  VARIANT *phWindow);

Launch the PuTTY session with the input credentials and return the PuTTY window handle

Example: Dim test Set test = CreateObject("ACLauncher.ACWebLauncher") Hwnd = test. LaunchePUTTY ("hostname.ca.com", "root", "password")

LauncheProcessAsUser (BSTR bsApplication, BSTR bsCommandline, BSTR bsUsername, BSTR bsPassword, VARIANT *phWindow);

Launch process with the input credentials and return the process window handle

Example: Dim test Set test = CreateObject("ACLauncher.ACWebLauncher") Hwnd = test.LauncheProcessAsUser("cmd.exe", "/k echo This console is run under %USERNAME% account...", "administrator" , "password")

GetWindowProcessID(VARIANT *phWindow, LONG *pProcessID);

Return the process ID of a specified window handle

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") id = test.GetWindowProcessID(hwnd) test.Echo "Process ID = " & id

GetWindowTitle(VARIANT *phWindow, BSTR *pbsTitle);

Return the Title of a specified window handle

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") title = test.GetWindowTitle(hwnd)

CloseWindow(VARIANT *phWindow, LONG Seconds);

Display a dialog box with a message specifying that the window will close in X seconds and close the window of a specified window handle

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") test.Sleep(5000) test.CloseWindow(hwnd, 60)

SetTimeoutEvent(LONG seconds);

Specify the timeout for "WaitForEvents" method. Once reached, the WaitForEvents method returns from its blocking call with a return value that indicates the timeout reached

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") test.SetTimeoutEvent(10)

SetWindowCloseEvent(VARIANT *phWindow);

Specify the window closing event for the "WaitForEvents" method. After the window is closed, the "WaitForEvents" method returns from its blocking call and displays the return value that indicates that the window was closed

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") test.SetWindowCloseEvent(hwnd)

SetServerCheckinEvent(BSTR bsURL);

Sets the SAM check-in event as a block execution condition. The ActiveX queries SAM every 5 seconds

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") test.SetServerCheckinEvent("http://server.com/__azy?djfhwek5jy34brfhwkeb") (replace with variable)

WaitForEvents(VARIANT *pRetVal);

Blocks the script execution until one of the register conditions is correct.

Options:1—the user closed the window, 2—timeout elapsed, 3—password checked in at the server side

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") test.SetServerCheckinEvent("http://server.com/__azy?djfhwek5jy34brfhwkeb")

test.SetWindowCloseEvent(hwnd) test.SetTimeoutEvent(360) rc = test.WaitForEvents() If rc = 3 Then call test.CloseWindow(hwnd, 10) End If

SwitchToThisWindow(VARIANT *phWindow);

Positions the window at the top of the Z order

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password") test.SwitchToThisWindow(hwnd)

SendCheckinEvent(BSTR bsURL);

Send check in event when user closes the window

Example: Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.LauncheRDP("hostname", "administrator", "password")

Sleep(LONG milliseconds);

Pauses the script execution

Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.Sleep(2000)

Echo(VARIANT* pArgs);

Print messages to screen

Set test = CreateObject("ACLauncher.ACWebLauncher") hwnd = test.Echo("Password Checkin")