You can use macros to configure SSH connections for new sessions.
If you prefer to run macros in pre-configured sessions instead of creating your own sessions, you can download the VBA Sample Sessions and open the create-an-ssh-session.xlsm file. The download package contains everything you need to run the macros in this file. See Download the VBA Sample Sessions.
This Microsoft Excel macro creates, configures, and connects to a new SSH terminal connection.
This sample applies only to Open Systems terminals.
Create an SSH Session |
Copy Code
|
---|---|
Sub OpenSSHConnection() Dim App As Attachmate_Reflection_Objects_Framework.ApplicationObject Dim Terminal As Attachmate_Reflection_Objects_Emulation_OpenSystems.Terminal Dim Frame As Attachmate_Reflection_Objects.Frame On Error Resume Next 'Try to use the existing workspace Set App = GetObject("Reflection Workspace") On Error GoTo 0 'Otherwise, Create New instance of Reflection If IsEmpty(App) Or (App Is Nothing) Then Set App = _ CreateObject("Attachmate_Reflection_Objects_Framework.ApplicationObject") With App Do While .IsInitialized = False .Wait 200 Loop 'Obtain the Frame Handle Set Frame = .GetObject("Frame") 'Make it visible to the user Frame.Visible = True End With 'Create an Open Systems control and immediately turn off autoconnect Set Terminal = App.CreateControl2("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}") With Terminal .AutoConnect = False 'Set the connection type .ConnectionType = ConnectionTypeOption_SecureShell 'Set your hostname and other connection settings With .ConnectionSettingsSecureShell .HostAddress = "hostName or IP Address" .UserName = "admin" End With End With 'Create a view for the terminal Set View = Frame.CreateView(Terminal) 'Manually call connect because Auto is now disabled Terminal.Connect End Sub |
To set up scripts that automatically connect to sessions with SSH, see the following technical notes.
Automating SSH, SFTP, and SCP with Windows Scheduled Tasks (http://support.attachmate.com/techdocs/2329.html) Configuring Reflection for Public Key Authentication in Secure Shell Connections (http://support.attachmate.com/techdocs/1881.html)