Jump to content

RDP crashing AutoIt on running on Remote computer


Recommended Posts

Has anyone seen this odd behavior where an autoit program is running on a remote computer. When you use Microsoft's Remote Desktop client to remote in on that machine, no problem. But if the user at some point later logs on locally to that same machine, autoit crashes?

I'm not sure why it happens. I was just wondering if anyone in general ever has experienced this and maybe what they did to stop the odd behavior.

Thank you!

Edited by coffeeturtle
Link to comment
Share on other sites

I can't say I've seen that behavior in general, but that's a tough determination without knowing the nature of the script which produces the issue. Furthermore inspection of the actual code involved might be required to truly narrow the cause.

Can you elaborate some?

Link to comment
Share on other sites

Sorry about the scant amount of information. I was kind of wondering it was a bug with autoit since my script has nothing to do with remote access. I'm going to try to narrow down some of the code and post it here. Line numbers don't match well with the error messages, but maybe JScript's autoiterrortrap might help me.

Thanks again and I will try to post soon.

Link to comment
Share on other sites

You can try adding the following

#include <File.au3>
OnAutoItExitRegister ( "_exit" )
global $gsLogPath=@DesktopCommonDir&"log.txt"
_FileWriteLog($gsLogPath, "script started")

;your script here


Func _exit()
local $sMethod
Switch @exitMethod
case 0
$sMethod="Natural closing."
case 1
$sMethod="close by Exit function."
case 2
$sMethod="close by clicking on exit of the systray."
case 3
$sMethod="close by user logoff."
case 4
$sMethod="close by Windows shutdown."
EndSwitch

Local $sLogMsg="Exiting with exit code "&@exitCode& " by "&$sMethod

_FileWriteLog($gsLogPath, $sLogMsg )
exit
EndFunc

You could also launch your script with PSEXEC if it is not gui based.

Edited by DicatoroftheUSA
Link to comment
Share on other sites

Another way using an Array.

#include <File.au3>

OnAutoItExitRegister('_Exit')

Global $__sLogFilePath = @ScriptDir & 'log.txt'
_FileWriteLog($__sLogFilePath, 'Script started')

; Script here.

Func _Exit()
    Local $aExit[5] = ['Natural closing.', 'Closed by Exit function.', 'Closed by clicking on exit of the systray.', _
            'Closed by user logoff.', 'Closed by Windows shutdown.']
    _FileWriteLog($__sLogFilePath, 'Exiting with exit code ' & @exitCode & ' by ' & $aExit[@exitCode])
    $aExit = 0
    Exit @exitCode
EndFunc   ;==>_Exit

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...