Not able to connect using AutoIt custom connector created uing AutoIt.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to connect using AutoIt custom connector created uing AutoIt.

L1 Bithead

I have created a Radware Alteon connector using AutoIt. But I am facing the following error.

Field_Content_versions_oct20__068Ht00000TlHDAIA3.png#AutoIt3Wrapper_UseX64=n

Opt("MustDeclareVars", 1)

AutoItSetOption("WinTitleMatchMode", 3) ; EXACT_MATCH!

 

;============================================================

;       PSM AutoIt Dispatcher Skeleton

;       ------------------------------

;============================================================

#include "PSMGenericClientWrapper.au3"

 

;=======================================

; Consts & Globals

;=======================================

 

Global $TargetUsername

Global $TargetPassword

Global $TargetAddress

Global $ConnectionClientPID = 0

 

Global Const $DISPATCHER_NAME   = "Radware" ; CHANGE_ME

Global $CLIENT_EXECUTABLE       = "C:\Program Files\internet explorer\iexplore.exe https://" ; CHANGE_ME

Global Const $ERROR_MESSAGE_TITLE  = "PSM " & $DISPATCHER_NAME & " Dispatcher error message"

Global Const $LOG_MESSAGE_PREFIX = $DISPATCHER_NAME & " Dispatcher - "

 

;=======================================

; Code

;=======================================

Exit Main()

;=======================================

; Main

;=======================================

Func Main()

 

; Init PSM Dispatcher utils wrapper

ToolTip ("Initializing...")

if (PSMGenericClient_Init() <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

 

LogWrite("successfully initialized Dispatcher Utils Wrapper")

 

; Get the dispatcher parameters

FetchSessionProperties()

$CLIENT_EXECUTABLE=$CLIENT_EXECUTABLE&$TargetAddress

;ToolTip ("Address ...." & $CLIENT_EXECUTABLE)

;Sleep(3000)

 

LogWrite("mapping local drives")

if (PSMGenericClient_MapTSDrives() <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

 

LogWrite("starting client application")

ToolTip ("Starting " & $DISPATCHER_NAME & "...")

$ConnectionClientPID = Run($CLIENT_EXECUTABLE)

if ($ConnectionClientPID == 0) Then

Error(StringFormat("Failed to execute process [%s]", $CLIENT_EXECUTABLE, @error))

EndIf

 

; ------------------

; Handle login here! ; CHANGE_ME

; ------------------

Login() 

; Send PID to PSM so recording/monitoring can begin

; Notice that until we send the PID, PSM blocks all user input.

LogWrite("sending PID to PSM")

if (PSMGenericClient_SendPID($ConnectionClientPID) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

 

; Terminate PSM Dispatcher utils wrapper

LogWrite("Terminating Dispatcher Utils Wrapper")

PSMGenericClient_Term()

 

Return $PSM_ERROR_SUCCESS

EndFunc

 

 

Func Login()

;BlockInput(0)

  ToolTip ("Please wait...")

Sleep(2000)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{ENTER}")

Sleep(300)

Send("{TAB}")

Sleep(300)

Send("{TAB}")

Sleep(1000)

Send("{ENTER}")

Sleep(1000)

WinWait("Windows Security")

WinActivate("Windows Security")

WinWaitActive("Windows Security")

Sleep(300)

Send($TargetUsername,1)

Send("{TAB}")

Send($TargetPassword,1)

Send("{TAB 2}")

Send("{ENTER}")

;if WinActive($Use) Then

; Sleep(100)

; Send("{ENTER}")

;EndIf

 

;Sleep(100)

;$ConnectionClientPID=WinGetProcess($OracleDevLogin_Title)

BlockInput(0)

;return $ConnectionClientPID

EndFunc

 

 

;==================================

; Functions

;==================================

; #FUNCTION# ====================================================================================================================

; Name...........: Error

; Description ...: An exception handler - displays an error message and terminates the dispatcher

; Parameters ....: $ErrorMessage - Error message to display

;   $Code - [Optional] Exit error code

; ===============================================================================================================================

Func Error($ErrorMessage, $Code = -1)

 

; If the dispatcher utils DLL was already initialized, write an error log message and terminate the wrapper

if (PSMGenericClient_IsInitialized()) Then

LogWrite($ErrorMessage, True)

PSMGenericClient_Term()

EndIf

 

Local $MessageFlags = BitOr(0, 16, 262144) ; 0=OK button, 16=Stop-sign icon, 262144=MsgBox has top-most attribute set

 

MsgBox($MessageFlags, $ERROR_MESSAGE_TITLE, $ErrorMessage)

 

; If the connection component was already invoked, terminate it

if ($ConnectionClientPID <> 0) Then

ProcessClose($ConnectionClientPID)

$ConnectionClientPID = 0

EndIf

 

Exit $Code

EndFunc

 

; #FUNCTION# ====================================================================================================================

; Name...........: LogWrite

; Description ...: Write a PSMWinSCPDispatcher log message to standard PSM log file

; Parameters ....: $sMessage - [IN] The message to write

;         $LogLevel - [Optional] [IN] Defined if the message should be handled as an error message or as a trace messge

; Return values .: $PSM_ERROR_SUCCESS - Success, otherwise error - Use PSMGenericClient_PSMGetLastErrorString for details.

; ===============================================================================================================================

Func LogWrite($sMessage, $LogLevel = $LOG_LEVEL_TRACE)

Return PSMGenericClient_LogWrite($LOG_MESSAGE_PREFIX & $sMessage, $LogLevel)

EndFunc

 

; #FUNCTION# ====================================================================================================================

; Name...........: PSMGenericClient_GetSessionProperty

; Description ...: Fetches properties required for the session 

; Parameters ....: None

; Return values .: None

; ===============================================================================================================================

Func FetchSessionProperties() ; CHANGE_ME

if (PSMGenericClient_GetSessionProperty("Username", $TargetUsername) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

 

if (PSMGenericClient_GetSessionProperty("Password", $TargetPassword) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

 

if (PSMGenericClient_GetSessionProperty("Address", $TargetAddress) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

EndFunc

 

The following is the script used for it .

 

Please let me know if it is incorrect and need to change any thing.

4 REPLIES 4

L7 Applicator

Hi @Akanksha Sharma​ 

 

Can you please confirm the following?

 

  • Is the IE browser path and .exe excluded from the AppLocker rules?
  • Whether the "ClientInvokeType" set to "Dispatcher" in the Connection Component?
  • Have you tried increasing 'ConnectionComponentInitTimeOut' in the Connection Component?

 

Also can you try the following?

 

  • Replace $ConnectionClientPID = Run($CLIENT_EXECUTABLE) with $ConnectionClientPID = Run('"' & $CLIENT_EXECUTABLE & $TargetAddress & '"')

L1 Bithead

Hi Malhar,

 

Thank you for your reply.

 

We have already did the following:

 

  • Is the IE browser path and .exe excluded from the AppLocker rules? -yes0
  • Whether the "ClientInvokeType" set to "Dispatcher" in the Connection Component? -yes
  • Have you tried increasing 'ConnectionComponentInitTimeOut' in the Connection Component? -yes, it is 10000

L7 Applicator

Hi @Akanksha Sharma​ 

 

Few more thoughts,

 

  1. Have you tried setting AppLocker rules to Audit Only mode ? Just to exclude any other processes that might be getting blocked.
  2. Can you please try to launch the Radware .au3 file from the PSM server and see what the outcome is ?
  3. Please try excluding IE in the AppLocker rule as Publisher
  4. Is IE path on the PSM server matches to the path defined in the script ?

 

 

 

 

L7 Applicator

Hi @Akanksha Sharma​ 

 

Just curious, whether the above issue is fixed and did above steps helped? Thanks!

  • 264 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!