Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 10-20-2017, 12:24 PM
mschaafs mschaafs is offline
Registered User
Join Date: Oct 2017
Posts: 27
Exclamation Excel Wscript VBA - Hostname lookup failed: host not found

Good day! I am trying to launch a SecureCRT session from a Microsoft Excel macro, but am running into an issue with regard to the session connecting successfully. It is opening SecureCRT, but then is spitting out an error:

"Hostname lookup failed: host not found"

Macro code:
Sub Launch_SecureCRT()
    ' Enter credentials in custom form
    strPassword = passkey
    strUsername = username
    'host and protocol
    strProtocol = "ssh2"
    strHostname = "host.com"
    ' Reference the SecureCRT script file to be run upon launch
    Set fso = CreateObject("Scripting.FileSystemObject")
    strScriptFile = "C:\Users\filepath\script.js" 

    ' Open SecureCRT and run script with login creds.
    Set objShell = CreateObject("wscript.shell")
    nResult = objShell.Run( _
        "SecureCRT /SCRIPT " & strScriptFile & _
        " /arg " & strHostname & _
        " /arg " & strUsername & _
        " /arg " & strProtocol & _
        " /PASSWORD " & strPassword, _
        5, True)

End Sub
Can someone please provide some insight? There is very little reference material for this out there.

Thank you for your time!
Reply With Quote

excel to securecrt , hostname , wscript

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 01:35 AM.