×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Powershell - using WINSCP to submit files to Filetype = JES

Powershell - using WINSCP to submit files to Filetype = JES

Powershell - using WINSCP to submit files to Filetype = JES

(OP)
Hi Everyone,

I am trying to automate a process that I think should be possible in Powershell using the WINSCP as a mediator.

The line in question is

CODE --> powershell

"call `"`"site filetype=JES`"`"" ` 
which I also tried

CODE --> powershell

"call site filetype=JES" ` 

CODE --> powershell

# PowerShell >=7.3

$PSNativeCommandArgumentPassing = "Legacy"

& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
  /log="C:\IPM\FTPLogs\WinSCP.log" /ini=nul `
  /Command  "open ftps://USERNAME:PW@SOMESITE.hhsc.texas.gov/" `
    "lcd c:\CareUpload\" `
    "call `"`"site filetype=JES`"`"" `
    "mput -nopreservetime -nopermissions  CB%TIMESTAMP#yymmdd%" `
    "exit"

$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
  Write-Host "Success"
}
else
{
  Write-Host "Error"
} 

The code runs and returns the following:

PS C:\Windows\system32> C:\Scripts\PutCareBatch.ps1
Connecting to SOMESITE.hhsc.texas.gov:990 ...
TLS connection established. Waiting for welcome message...
Connected
Starting the session...
Session started.
Active session: [1] LOGIN@SOMESITE.hhsc.texas.gov
c:\CareUpload
200 SITE command was accepted
CB230331 | 84 KB | 270.5 KB/s | binary | 100%
Success

The session is starting, the login is accepted, I am passing the site command and the file name and size is there correctly but it is not landing in the Site Filetype = JES area.

Does anyone have code for something similar?

RE: Powershell - using WINSCP to submit files to Filetype = JES

IMO it should be

CODE

"call site filetype=JES" ` 

RE: Powershell - using WINSCP to submit files to Filetype = JES

(OP)
Mikrom - one would think. The code runs and gives the verification that the SITE command was accepted but the file is not making it up to the remote server. I am wondering if it's a time issue. Like the time between the verification and the transfer of the file needs a little break in between.

RE: Powershell - using WINSCP to submit files to Filetype = JES

and are you sure that this mput works ?:

CODE

"mput -nopreservetime -nopermissions  CB%TIMESTAMP#yymmdd%" ` 
Have you tried instead only simple put like this if it works or not ?:

CODE

"put only_one_file" ` 

RE: Powershell - using WINSCP to submit files to Filetype = JES

(OP)
I will try that this afternoon. Another restraint here is that I can only test in a little window everyday because you get 1 batch upload per day. I will let you know if it works.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close