Hi Stefan,
After some testing, I have found a way to accomplish your goal. First, you must configure SecureCRT to not save settings by disabling
Options / Auto Save Options. After disabling this option, you must use
Options / Save Settings Now to save the change you have made.
With this SecureCRT configuration change, you should be able to run the following script to load a session, change the username and connect with the new username.
Code:
' Load session to be used for connection
Set objConfig = crt.OpenSessionConfiguration("<session_name>")
MsgBox objConfig.GetOption("Username")
' Prompt user for new username to use
strNewUN = crt.Dialog.Prompt("Please enter the new username.")
' Set the new username entered by the user
objConfig.SetOption "Username", strNewUN
MsgBox objConfig.GetOption("Username")
' Connect to the remote device using the new username
objConfig.ConnectInTab
Another option would be to use an ad hoc session. For example:
Code:
crt.Session.Connect "/ssh2 hostname"
Does this help to answer your question?