Topic "4.3.5 Stored host name in Scripting"

Author Message
lravens19
[View user's profile]

Joined: 2011-05-10
Posts: 17
Server: windows 2003R2 server sp2
Winscp: 4.3.5
Using scripting/automation

Script:
echo option batch abort > c:\windows\Harvardftp.txt
echo open HPHC >> c:\windows\Harvardftp.txt
echo cd 837/toHPHC >> c:\windows\Harvardftp.txt
echo put HPHC1425_HPHC142501_P_%year%%month%%day%_%nhour%%xminute%.837 >> c:\windows\Harvardftp.txt
echo bye >> c:\windows\Harvardftp.txt

When I run my script to connect to a stored session it will not connect to a stored session "HPHC". When I try to just double click on the stored session in the gui it connects fine. I compared both scripting log and gui log and noticed a difference. The "host name" is not carrying through in the script. You can see in the logs below that the scripted log tries to connect to a the host name which is really the session name. And the Gui connects to the actual host name. This was a fresh install of 4.3.5 on a new server.

Scripting/automated log:
. 2011-09-22 13:59:04.499 --------------------------------------------------------------------------
. 2011-09-22 13:59:04.499 WinSCP Version 4.3.5 (Build 1463) (OS 5.2.3790 Service Pack 2)
. 2011-09-22 13:59:04.499 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2011-09-22 13:59:04.499 Local account: NT_PROD\rmgsupp
. 2011-09-22 13:59:04.499 Login time: Thursday, September 22, 2011 1:59:04 PM
. 2011-09-22 13:59:04.499 --------------------------------------------------------------------------
. 2011-09-22 13:59:04.499 Session name: HPHC (Ad-Hoc session)
. 2011-09-22 13:59:04.499 Host name: HPHC (Port: 22)
. 2011-09-22 13:59:04.499 User name: (Password: No, Key file: No)
. 2011-09-22 13:59:04.499 Tunnel: No
. 2011-09-22 13:59:04.499 Transfer Protocol: SFTP (SCP)
. 2011-09-22 13:59:04.499 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2011-09-22 13:59:04.499 Proxy: none
. 2011-09-22 13:59:04.499 SSH protocol version: 2; Compression: No
. 2011-09-22 13:59:04.499 Bypass authentication: No
. 2011-09-22 13:59:04.499 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2011-09-22 13:59:04.499 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2011-09-22 13:59:04.499 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2011-09-22 13:59:04.499 SFTP Bugs: -,-
. 2011-09-22 13:59:04.499 Return code variable: Autodetect; Lookup user groups: Yes
. 2011-09-22 13:59:04.499 Shell: default
. 2011-09-22 13:59:04.499 EOL: 0, UTF: 2
. 2011-09-22 13:59:04.499 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2011-09-22 13:59:04.499 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2011-09-22 13:59:04.499 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-09-22 13:59:04.499 Cache directory changes: Yes, Permanent: Yes
. 2011-09-22 13:59:04.499 DST mode: 1
. 2011-09-22 13:59:04.499 --------------------------------------------------------------------------
. 2011-09-22 13:59:04.499 Looking up host "HPHC"

GUI Log:
. 2011-09-22 14:19:29.806 --------------------------------------------------------------------------
. 2011-09-22 14:19:29.806 WinSCP Version 4.3.5 (Build 1463) (OS 5.2.3790 Service Pack 2)
. 2011-09-22 14:19:29.806 Configuration: C:\Program Files (x86)\WinSCP\WinSCP.ini
. 2011-09-22 14:19:29.806 Local account: NT_PROD\rmgsupp
. 2011-09-22 14:19:29.806 Login time: Thursday, September 22, 2011 2:19:29 PM
. 2011-09-22 14:19:29.806 --------------------------------------------------------------------------
. 2011-09-22 14:19:29.806 Session name: HPHC (Modified stored session)
. 2011-09-22 14:19:29.806 Host name: sftp.harvardpilgrim.org (Port: 22)
. 2011-09-22 14:19:29.806 User name: pfhp1425 (Password: Yes, Key file: No)
. 2011-09-22 14:19:29.806 Tunnel: No
. 2011-09-22 14:19:29.806 Transfer Protocol: SFTP (SCP)
. 2011-09-22 14:19:29.806 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2011-09-22 14:19:29.806 Proxy: none
. 2011-09-22 14:19:29.806 SSH protocol version: 2; Compression: No
. 2011-09-22 14:19:29.806 Bypass authentication: No
. 2011-09-22 14:19:29.806 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2011-09-22 14:19:29.806 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2011-09-22 14:19:29.806 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2011-09-22 14:19:29.806 SFTP Bugs: -,-
. 2011-09-22 14:19:29.806 Return code variable: Autodetect; Lookup user groups: Yes
. 2011-09-22 14:19:29.806 Shell: default
. 2011-09-22 14:19:29.806 EOL: 0, UTF: 2
. 2011-09-22 14:19:29.806 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2011-09-22 14:19:29.806 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2011-09-22 14:19:29.806 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-09-22 14:19:29.806 Cache directory changes: Yes, Permanent: Yes
. 2011-09-22 14:19:29.806 DST mode: 1
. 2011-09-22 14:19:29.806 --------------------------------------------------------------------------
. 2011-09-22 14:19:29.821 Looking up host "sftp.harvardpilgrim.org"
. 2011-09-22 14:19:29.946 Connecting to 155.49.240.29 port 22
. 2011-09-22 14:19:30.040 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:30.040 Detected network event
. 2011-09-22 14:19:35.087 Detected network event
. 2011-09-22 14:19:35.087 Server version: SSH-2.0-4.1.5.6 SSH Secure Shell Windows NT Server
. 2011-09-22 14:19:35.087 We believe remote version has SSH-2 ignore bug
. 2011-09-22 14:19:35.087 Using SSH protocol version 2
. 2011-09-22 14:19:35.087 We claim version: SSH-2.0-WinSCP_release_4.3.5
. 2011-09-22 14:19:35.087 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:35.181 Detected network event
. 2011-09-22 14:19:35.181 Using Diffie-Hellman with standard group "group1"
. 2011-09-22 14:19:35.181 Doing Diffie-Hellman key exchange with hash SHA-1
. 2011-09-22 14:19:35.212 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:35.493 Detected network event
. 2011-09-22 14:19:35.556 Host key fingerprint is:
. 2011-09-22 14:19:35.556 ssh-dss 1024 ab:35:79:e7:f6:7d:b2:6d:99:d7:1d:52:01:8e:fa:b0
. 2011-09-22 14:19:35.556 Initialised AES-256 CBC client->server encryption
. 2011-09-22 14:19:35.556 Initialised HMAC-SHA1 client->server MAC algorithm
. 2011-09-22 14:19:35.556 Initialised AES-256 CBC server->client encryption
. 2011-09-22 14:19:35.556 Initialised HMAC-SHA1 server->client MAC algorithm
. 2011-09-22 14:19:35.556 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:35.915 Detected network event
! 2011-09-22 14:19:35.915 Using username "pfhp1425".
. 2011-09-22 14:19:35.915 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:36.009 Detected network event
. 2011-09-22 14:19:36.009 Prompt (7, SSH password, , &Password: )
. 2011-09-22 14:19:36.009 Using stored password.
. 2011-09-22 14:19:36.009 Sent password
. 2011-09-22 14:19:36.009 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:36.274 Detected network event
. 2011-09-22 14:19:36.274 Access granted
. 2011-09-22 14:19:36.274 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:36.368 Detected network event
. 2011-09-22 14:19:36.368 Opened channel for session
. 2011-09-22 14:19:36.368 Waiting for the server to continue with the initialisation
. 2011-09-22 14:19:36.774 Detected network event
. 2011-09-22 14:19:36.774 Started a shell/command
. 2011-09-22 14:19:36.774 --------------------------------------------------------------------------
. 2011-09-22 14:19:36.774 Using SFTP protocol.
. 2011-09-22 14:19:36.774 Doing startup conversation with host.
> 2011-09-22 14:19:36.774 Type: SSH_FXP_INIT, Size: 5, Number: -1
. 2011-09-22 14:19:36.774 Sent 9 bytes
. 2011-09-22 14:19:36.774 There are 0 bytes remaining in the send buffer
. 2011-09-22 14:19:36.774 Waiting for another 4 bytes
. 2011-09-22 14:19:36.868 Detected network event
. 2011-09-22 14:19:36.868 Received 38 bytes (0)
. 2011-09-22 14:19:36.868 Read 4 bytes (34 pending)
. 2011-09-22 14:19:36.868 Read 34 bytes (0 pending)
< 2011-09-22 14:19:36.868 Type: SSH_FXP_VERSION, Size: 34, Number: -1
. 2011-09-22 14:19:36.868 SFTP version 3 negotiated.
. 2011-09-22 14:19:36.868 Unknown server extension newline@vandyke.com="\r\n"
. 2011-09-22 14:19:36.868 We believe the server has signed timestamps bug
. 2011-09-22 14:19:36.868 We will use UTF-8 strings for status messages only
. 2011-09-22 14:19:36.868 Getting current directory name.
. 2011-09-22 14:19:36.868 Getting real path for '.'
> 2011-09-22 14:19:36.868 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
. 2011-09-22 14:19:36.868 Sent 14 bytes
. 2011-09-22 14:19:36.868 There are 0 bytes remaining in the send buffer
. 2011-09-22 14:19:36.868 Waiting for another 4 bytes
. 2011-09-22 14:19:36.962 Detected network event
. 2011-09-22 14:19:36.962 Received 35 bytes (0)
. 2011-09-22 14:19:36.962 Read 4 bytes (31 pending)
. 2011-09-22 14:19:36.962 Read 31 bytes (0 pending)
< 2011-09-22 14:19:36.962 Type: SSH_FXP_NAME, Size: 31, Number: 16
. 2011-09-22 14:19:36.962 Real path is '/HOME'
. 2011-09-22 14:19:36.962 Listing directory "/HOME".
> 2011-09-22 14:19:36.962 Type: SSH_FXP_OPENDIR, Size: 14, Number: 267
. 2011-09-22 14:19:36.962 Sent 18 bytes
. 2011-09-22 14:19:36.962 There are 0 bytes remaining in the send buffer
. 2011-09-22 14:19:36.962 Waiting for another 4 bytes
. 2011-09-22 14:19:37.040 Detected network event
. 2011-09-22 14:19:37.040 Received 21 bytes (0)
. 2011-09-22 14:19:37.040 Read 4 bytes (17 pending)
. 2011-09-22 14:19:37.040 Read 17 bytes (0 pending)
< 2011-09-22 14:19:37.040 Type: SSH_FXP_HANDLE, Size: 17, Number: 267
> 2011-09-22 14:19:37.040 Type: SSH_FXP_READDIR, Size: 17, Number: 524
. 2011-09-22 14:19:37.040 Sent 21 bytes
. 2011-09-22 14:19:37.040 There are 0 bytes remaining in the send buffer
. 2011-09-22 14:19:37.040 Waiting for another 4 bytes
. 2011-09-22 14:19:37.196 Detected network event
. 2011-09-22 14:19:37.196 Received 415 bytes (0)
. 2011-09-22 14:19:37.196 Read 4 bytes (411 pending)
. 2011-09-22 14:19:37.196 Read 411 bytes (0 pending)
< 2011-09-22 14:19:37.196 Type: SSH_FXP_NAME, Size: 411, Number: 524
> 2011-09-22 14:19:37.196 Type: SSH_FXP_READDIR, Size: 17, Number: 780
. 2011-09-22 14:19:37.196 Sent 21 bytes
. 2011-09-22 14:19:37.196 There are 0 bytes remaining in the send buffer
. 2011-09-22 14:19:37.196 Read file '.' from listing
. 2011-09-22 14:19:37.196 Read file '..' from listing
. 2011-09-22 14:19:37.196 Read file '835' from listing
. 2011-09-22 14:19:37.196 Read file '837' from listing
. 2011-09-22 14:19:37.196 Waiting for another 4 bytes
. 2011-09-22 14:19:37.274 Detected network event
. 2011-09-22 14:19:37.274 Received 26 bytes (0)
. 2011-09-22 14:19:37.274 Read 4 bytes (22 pending)
. 2011-09-22 14:19:37.274 Read 22 bytes (0 pending)
< 2011-09-22 14:19:37.274 Type: SSH_FXP_STATUS, Size: 22, Number: 780
< 2011-09-22 14:19:37.274 Status code: 1
> 2011-09-22 14:19:37.274 Type: SSH_FXP_CLOSE, Size: 17, Number: 1028
. 2011-09-22 14:19:37.274 Sent 21 bytes
. 2011-09-22 14:19:37.274 There are 0 bytes remaining in the send buffer
. 2011-09-22 14:19:37.274 Startup conversation with host finished.
. 2011-09-22 14:19:37.931 Session upkeep
. 2011-09-22 14:19:37.931 Detected network event
. 2011-09-22 14:19:37.931 Received 25 bytes (0)
. 2011-09-22 14:19:38.431 Session upkeep
. 2011-09-22 14:19:45.821 Closing connection.
. 2011-09-22 14:19:45.821 Sending special code: 12
. 2011-09-22 14:19:45.821 Sent EOF message
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24538
Location: Prague, Czechia
The WinSCP instance running the script does not see the stored session.

You are probably using different local account that when you use GUI.

Please read FAQ:
http://winscp.net/eng/docs/faq_environment

Quote:
. 2011-09-22 13:59:04.499 --------------------------------------------------------------------------
. 2011-09-22 13:59:04.499 WinSCP Version 4.3.5 (Build 1463) (OS 5.2.3790 Service Pack 2)
. 2011-09-22 13:59:04.499 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2011-09-22 13:59:04.499 Local account: NT_PROD\rmgsupp
. 2011-09-22 13:59:04.499 Login time: Thursday, September 22, 2011 1:59:04 PM
. 2011-09-22 13:59:04.499 --------------------------------------------------------------------------
. 2011-09-22 13:59:04.499 Session name: HPHC (Ad-Hoc session)
lravens19
[View user's profile]

Joined: 2011-05-10
Posts: 17
Hey Martin, but in both of my logs i posted (scripted and GUI) they are both using the same account "nt_prod/rmgsupp".
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24538
Location: Prague, Czechia
OK, but you are using registry in script:
Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\

but INI file in GUI:
Configuration: C:\Program Files (x86)\WinSCP\WinSCP.ini
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License