Two different behaviors when batch file is called to launch WinSCP script.

Advertisement

Mike M.
Guest

Two different behaviors when batch file is called to launch WinSCP script.

When a DOS prompt is opened and this command is run, the log looks fine and the file posts. Here is the log for the session. winscp.exe /console /script=C:\IBM\InformationServer\Server\Projects\Scripts\WinSCP_Post_AllFiles_SFMC.txt /log=C:\IBM\InformationServer\Server\Projects\Scripts\FTPFiles_Log_SFMC_Outbound.txt

See log WORKING below.

When the same batch is called via Datastage, the log is different and it seems to not know how to resolve the saved site "marketingcloud"

See log NOT WORKING below.



Log WORKING
2015-11-22 14:58:51.998 WinSCP Version 5.5.6 (Build 4746) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Standard)
. 2015-11-22 14:58:51.998 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2015-11-22 14:58:51.998 Local account: PFHQ\mmappes
. 2015-11-22 14:58:51.998 Working directory: C:\IBM\InformationServer\Server\Projects\Scripts
. 2015-11-22 14:58:51.998 Process ID: 8432
. 2015-11-22 14:58:51.998 Command-line: winscp.exe /console /script=C:\IBM\InformationServer\Server\Projects\Scripts\WinSCP_Post_AllFiles_SFMC.txt /log=C:\IBM\InformationServer\Server\Projects\Scripts\FTPFiles_Log_SFMC_Outbound.txt
. 2015-11-22 14:58:51.998 Time zone: Current: GMT-5, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/8/2015, DST End: 11/1/2015
. 2015-11-22 14:58:51.998 Login time: Sunday, November 22, 2015 2:58:51 PM
. 2015-11-22 14:58:51.998 --------------------------------------------------------------------------
. 2015-11-22 14:58:51.998 Script: Retrospectively logging previous script records:
> 2015-11-22 14:58:51.998 Script: option batch on
< 2015-11-22 14:58:51.998 Script: batch on
> 2015-11-22 14:58:51.998 Script: option confirm off
< 2015-11-22 14:58:51.998 Script: confirm off
> 2015-11-22 14:58:51.998 Script: open marketingcloud
. 2015-11-22 14:58:51.998 --------------------------------------------------------------------------
. 2015-11-22 14:58:51.998 Session name: marketingcloud (Site)
. 2015-11-22 14:58:51.998 Host name: ftp.s7.exacttarget.com (Port: 22)
. 2015-11-22 14:58:51.998 User name: 7227272 (Password: Yes, Key file: No)
. 2015-11-22 14:58:51.998 Tunnel: No
. 2015-11-22 14:58:51.998 Transfer Protocol: SFTP (SCP)
. 2015-11-22 14:58:51.998 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2015-11-22 14:58:51.998 Proxy: none
. 2015-11-22 14:58:51.998 Send buffer: 262144
. 2015-11-22 14:58:51.998 SSH protocol version: 2; Compression: No
. 2015-11-22 14:58:51.998 Bypass authentication: No
. 2015-11-22 14:58:51.998 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: No; GSSAPI: No
. 2015-11-22 14:58:51.998 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2015-11-22 14:58:51.998 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2015-11-22 14:58:51.998 Simple channel: Yes
. 2015-11-22 14:58:51.998 Return code variable: Autodetect; Lookup user groups: A
. 2015-11-22 14:58:51.998 Shell: default
. 2015-11-22 14:58:51.998 EOL: 0, UTF: 2
. 2015-11-22 14:58:51.998 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2015-11-22 14:58:51.998 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2015-11-22 14:58:51.998 SFTP Bugs: A,A
. 2015-11-22 14:58:51.998 SFTP Server: default
. 2015-11-22 14:58:51.998 Local directory: C:\, Remote directory: /Import, Update: Yes, Cache: Yes
. 2015-11-22 14:58:51.998 Cache directory changes: Yes, Permanent: Yes
. 2015-11-22 14:58:51.998 DST mode: 1; Timezone offset: 0h 0m
. 2015-11-22 14:58:51.998 --------------------------------------------------------------------------
. 2015-11-22 14:58:51.998 Looking up host "ftp.s7.exacttarget.com"
. 2015-11-22 14:58:52.014 Connecting to 136.147.129.16 port 22
. 2015-11-22 14:58:52.045 Server version: SSH-2.0-1.82_sshlib Globalscape
. 2015-11-22 14:58:52.045 Using SSH protocol version 2
. 2015-11-22 14:58:52.045 We claim version: SSH-2.0-WinSCP_release_5.5.6
. 2015-11-22 14:58:52.061 Doing Diffie-Hellman group exchange
. 2015-11-22 14:58:52.092 Doing Diffie-Hellman key exchange with hash SHA-1
. 2015-11-22 14:58:52.295 Verifying host key
. 2015-11-22 14:58:52.295 Host key matches cached key
. 2015-11-22 14:58:52.295 Host key fingerprint is:
. 2015-11-22 14:58:52.295 ssh-rsa [REMOVED]
. 2015-11-22 14:58:52.295 Initialised AES-256 SDCTR client->server encryption
. 2015-11-22 14:58:52.295 Initialised HMAC-SHA1 client->server MAC algorithm
. 2015-11-22 14:58:52.295 Initialised AES-256 SDCTR server->client encryption
. 2015-11-22 14:58:52.295 Initialised HMAC-SHA1 server->client MAC algorithm
! 2015-11-22 14:58:52.326 Using username "7227272".
. 2015-11-22 14:58:52.342 Prompt (7, SSH password, , &Password: )
. 2015-11-22 14:58:52.342 Using stored password.
. 2015-11-22 14:58:52.342 Sent password
. 2015-11-22 14:58:52.357 Access granted
. 2015-11-22 14:58:52.357 Opening session as main channel
. 2015-11-22 14:58:52.373 Opened main channel
. 2015-11-22 14:58:52.404 Started a shell/command
. 2015-11-22 14:58:52.404 --------------------------------------------------------------------------
. 2015-11-22 14:58:52.404 Using SFTP protocol.
. 2015-11-22 14:58:52.420 Doing startup conversation with host.
> 2015-11-22 14:58:52.420 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2015-11-22 14:58:52.435 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2015-11-22 14:58:52.435 SFTP version 3 negotiated.
. 2015-11-22 14:58:52.435 We believe the server has signed timestamps bug
. 2015-11-22 14:58:52.435 We will use UTF-8 strings when appropriate
. 2015-11-22 14:58:52.435 Changing directory to "/Import".
. 2015-11-22 14:58:52.435 Getting real path for '/Import'
> 2015-11-22 14:58:52.435 Type: SSH_FXP_REALPATH, Size: 16, Number: 16
< 2015-11-22 14:58:52.451 Type: SSH_FXP_NAME, Size: 35, Number: 16
. 2015-11-22 14:58:52.451 Real path is '/Import'
. 2015-11-22 14:58:52.451 Trying to open directory "/Import".
> 2015-11-22 14:58:52.451 Type: SSH_FXP_LSTAT, Size: 16, Number: 263
< 2015-11-22 14:58:52.466 Type: SSH_FXP_ATTRS, Size: 21, Number: 263
. 2015-11-22 14:58:52.466 Getting current directory name.
. 2015-11-22 14:58:52.466 Startup conversation with host finished.
< 2015-11-22 14:58:52.466 Script: Active session: [1] marketingcloud
> 2015-11-22 14:58:52.466 Script: put G:\Datastage\Outboundfiles\SFMC\*.csv -nopreservetime -nopermissions
. 2015-11-22 14:58:52.466 Copying 1 files/directories to remote directory "/Import"
. 2015-11-22 14:58:52.466 PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2015-11-22 14:58:52.466 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM:
. 2015-11-22 14:58:52.466 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2015-11-22 14:58:52.466 File: 'G:\Datastage\Outboundfiles\SFMC\PF_AbandonedOnlineJoin.csv' [2015-11-22T19:39:25.547Z] [216457]
. 2015-11-22 14:58:52.466 Copying "G:\Datastage\Outboundfiles\SFMC\PF_AbandonedOnlineJoin.csv" to remote directory started.
. 2015-11-22 14:58:52.466 Binary transfer mode selected.
. 2015-11-22 14:58:52.466 Checking existence of file.
> 2015-11-22 14:58:52.466 Type: SSH_FXP_LSTAT, Size: 43, Number: 519
< 2015-11-22 14:58:52.482 Type: SSH_FXP_ATTRS, Size: 29, Number: 519
. 2015-11-22 14:58:52.482 Checking existence of partially transfered file.
> 2015-11-22 14:58:52.482 Type: SSH_FXP_LSTAT, Size: 52, Number: 775
< 2015-11-22 14:58:52.498 Type: SSH_FXP_STATUS, Size: 33, Number: 775
< 2015-11-22 14:58:52.498 Status code: 2
. 2015-11-22 14:58:52.498 Opening remote file.
> 2015-11-22 14:58:52.498 Type: SSH_FXP_OPEN, Size: 68, Number: 1027
< 2015-11-22 14:58:52.529 Type: SSH_FXP_HANDLE, Size: 10, Number: 1027
> 2015-11-22 14:58:52.529 Type: SSH_FXP_WRITE, Size: 4118, Number: 1542
. 2015-11-22 14:58:52.529 52 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2015-11-22 14:58:52.529 Type: SSH_FXP_CLOSE, Size: 10, Number: 15108
< 2015-11-22 14:58:52.544 Type: SSH_FXP_STATUS, Size: 21, Number: 1542
< 2015-11-22 14:58:52.576 Type: SSH_FXP_STATUS, Size: 21, Number: 1798
< 2015-11-22 14:58:52.576 Type: SSH_FXP_STATUS, Size: 21, Number: 2054
< 2015-11-22 14:58:52.591 Type: SSH_FXP_STATUS, Size: 21, Number: 2310
< 2015-11-22 14:58:52.591 Type: SSH_FXP_STATUS, Size: 21, Number: 2566
< 2015-11-22 14:58:52.591 Type: SSH_FXP_STATUS, Size: 21, Number: 2822
< 2015-11-22 14:58:52.591 Type: SSH_FXP_STATUS, Size: 21, Number: 3078
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 3334
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 3590
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 3846
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 4102
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 4358
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 4614
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 4870
< 2015-11-22 14:58:52.607 Type: SSH_FXP_STATUS, Size: 21, Number: 5126
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 5382
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 5638
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 5894
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 6150
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 6406
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 6662
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 6918
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 7174
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 7430
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 7686
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 7942
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 8198
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 8454
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 8710
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 8966
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 9222
< 2015-11-22 14:58:52.622 Type: SSH_FXP_STATUS, Size: 21, Number: 9478
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 9734
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 9990
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 10246
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 10502
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 10758
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 11014
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 11270
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 11526
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 11782
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 12038
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 12294
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 12550
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 12806
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 13062
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 13318
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 13574
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 13830
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 14086
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 14342
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 14598
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 14854
< 2015-11-22 14:58:52.747 Type: SSH_FXP_STATUS, Size: 21, Number: 15108
< 2015-11-22 14:58:52.747 Status code: 0
> 2015-11-22 14:58:52.747 Type: SSH_FXP_REMOVE, Size: 43, Number: 15373
< 2015-11-22 14:58:52.856 Type: SSH_FXP_STATUS, Size: 21, Number: 15373
< 2015-11-22 14:58:52.856 Status code: 0
> 2015-11-22 14:58:52.856 Type: SSH_FXP_RENAME, Size: 90, Number: 15634
< 2015-11-22 14:58:52.966 Type: SSH_FXP_STATUS, Size: 21, Number: 15634
< 2015-11-22 14:58:52.966 Status code: 0
> 2015-11-22 14:58:52.966 Type: SSH_FXP_SETSTAT, Size: 51, Number: 1289
< 2015-11-22 14:58:52.997 Type: SSH_FXP_STATUS, Size: 21, Number: 1289
< 2015-11-22 14:58:52.997 Status code: 0
> 2015-11-22 14:58:52.997 Script: close
. 2015-11-22 14:58:52.997 Closing connection.
. 2015-11-22 14:58:52.997 Sending special code: 12
. 2015-11-22 14:58:52.997 Sent EOF message

Log NOT WORKING
2015-11-22 15:01:38.403 --------------------------------------------------------------------------
. 2015-11-22 15:01:38.403 WinSCP Version 5.5.6 (Build 4746) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Standard)
. 2015-11-22 15:01:38.403 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2015-11-22 15:01:38.403 Local account: PFHQ\ETL_DW_DEV
. 2015-11-22 15:01:38.403 Working directory: C:\Program Files (x86)\WinSCP
. 2015-11-22 15:01:38.403 Process ID: 6892
. 2015-11-22 15:01:38.403 Command-line: winscp.exe /console /script=C:\IBM\InformationServer\Server\Projects\Scripts\WinSCP_Post_AllFiles_SFMC.txt /log=C:\IBM\InformationServer\Server\Projects\Scripts\FTPFiles_Log_SFMC_Outbound.txt
. 2015-11-22 15:01:38.403 Time zone: Current: GMT-5, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/8/2015, DST End: 11/1/2015
. 2015-11-22 15:01:38.403 Login time: Sunday, November 22, 2015 3:01:38 PM
. 2015-11-22 15:01:38.403 --------------------------------------------------------------------------
. 2015-11-22 15:01:38.403 Script: Retrospectively logging previous script records:
> 2015-11-22 15:01:38.403 Script: option batch on
< 2015-11-22 15:01:38.403 Script: batch on
> 2015-11-22 15:01:38.403 Script: option confirm off
< 2015-11-22 15:01:38.403 Script: confirm off
> 2015-11-22 15:01:38.403 Script: open @marketingcloud
. 2015-11-22 15:01:38.403 --------------------------------------------------------------------------
. 2015-11-22 15:01:38.403 Session name: marketingcloud (Modified site)
. 2015-11-22 15:01:38.403 Host name: marketingcloud (Port: 22)
. 2015-11-22 15:01:38.403 User name: (Password: No, Key file: No)
. 2015-11-22 15:01:38.403 Tunnel: No
. 2015-11-22 15:01:38.403 Transfer Protocol: SFTP (SCP)
. 2015-11-22 15:01:38.403 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2015-11-22 15:01:38.403 Proxy: none
. 2015-11-22 15:01:38.403 Send buffer: 262144
. 2015-11-22 15:01:38.403 SSH protocol version: 2; Compression: No
. 2015-11-22 15:01:38.403 Bypass authentication: No
. 2015-11-22 15:01:38.403 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2015-11-22 15:01:38.403 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2015-11-22 15:01:38.403 SSH Bugs: A,A,A,A,A,A,A,A,A,A
. 2015-11-22 15:01:38.403 Simple channel: Yes
. 2015-11-22 15:01:38.403 Return code variable: Autodetect; Lookup user groups: A
. 2015-11-22 15:01:38.403 Shell: default
. 2015-11-22 15:01:38.403 EOL: 0, UTF: 2
. 2015-11-22 15:01:38.403 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2015-11-22 15:01:38.403 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2015-11-22 15:01:38.403 SFTP Bugs: A,A
. 2015-11-22 15:01:38.403 SFTP Server: default
. 2015-11-22 15:01:38.403 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2015-11-22 15:01:38.403 Cache directory changes: Yes, Permanent: Yes
. 2015-11-22 15:01:38.403 DST mode: 1; Timezone offset: 0h 0m
. 2015-11-22 15:01:38.403 --------------------------------------------------------------------------
. 2015-11-22 15:01:38.403 Looking up host "marketingcloud"

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Two different behaviors when batch file is called to launch WinSCP script.

Because, against all recommendations on this site, you rely on stored site in your script. The stored sire is defined in registry and accessible by the PFHQ\mmappes account only.

Use a session URL instead.

See also https://winscp.net/eng/docs/faq_scheduler

Reply with quote

Advertisement

You can post new topics in this forum