winscp.com attempting to automate upload from c:\windows\system32\certsrv\certenroll\

Advertisement

cs_280zx
Joined:
Posts:
4
Location:
Sydney

winscp.com attempting to automate upload from c:\windows\system32\certsrv\certenroll\

Hi, we have two 2012 R2 servers with WinSCP (GUI client) installed (version: 5.7.4 - build 5553) and we have scripted it to attempt to upload files from the server where the WinSCP is installed, to two web servers.

I have tested the script and it does work from a (different directory) and on another PC (Windows 8.1) but for some reason, it won't put files referenced from that directory. Any suggestions or steps I am missing? I searched around and wasn't able to find anything like my situation.
ps: it's used to upload crl's for our pki servers as part of the 2012 PKI infrastructure here.

Script launch parameters:
c:\Program Files (x86)\WinSCP>winscp.com /script=c:\scripts\crl_transfer_pki.txt
Script layout:
# This script uploades the newly created CRLs To the PKI servers And overwrites existing files On the PKI Hosts
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect to SFTP server PKI-01 using a password
open sftp://xxxxxxxx:xxxxx@xxxxx.replaceme.com.au/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Change remote directory *using a temp location*
cd /var/www/html/CertEnroll
# Upload file
put C:\Windows\System32\certsrv\CertEnroll\*.crl
#
# Disconnect
#
#
# Connect to SFTP server PKI-02 using a password
open sftp://xxxxxxxx:xxxxx@xxxxx.replaceme.com.au/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Change remote directory *using a temp location*
cd /var/www/html/CertEnroll
# Upload file
put C:\Windows\System32\certsrv\CertEnroll\*.crl
#
# Disconnect
close
# Exit WinSCP
exit
When run, this is the output:
batch           abort     
reconnecttime   120       
confirm         off       
Searching for host...
Connecting to host...
Authenticating...
Using username "crl".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] crl@xxxxx.replaceme.com.au
/var/www/html/CertEnroll
No file matching '*.crl' found. (System Error.  Code: 3.

The system cannot find the path specified)
Searching for host...
Connecting to host...
Authenticating...
Using username "crl".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [2] crl@xxxxx.replaceme.com.au
/var/www/html/CertEnroll
No file matching '*.crl' found. (System Error.  Code: 3.

The system cannot find the path specified)
Session 'crl@xxxxx.replaceme.com.au' closed.
Active session: [1] crl@xxxxx.replaceme.com.au
I can verify files exist in this directory also, and it was executed in an elevated command prompt, logged in using domain administrator on the 2012 R2 server.

Any suggestions or assistance is appreciated.

thanks

Reply with quote

Advertisement

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

Re: winscp.com attempting to automate upload from c:\windows\system32\certsrv\certenroll\

The C:\Windows\System32 folder is "magic" on 64-bit Windows. It shows a different contents to 32-bit applications (WinSCP) than to 64-bit applications (e.g. Windows Explorer).

To 32-bit application (WinSCP), it shows actually a contents of C:\Windows\SysWOW64, where there's no certsrv subfolder.

There's probably no direct way to access certsrv from WinSCP. You can though create a directory junction to the subfolder to create an alternative access path.

Edit 2021: Actually, there is a hidden C:\Windows\sysnative, which can be used by 32-bit applications like WinSCP to access the 64-bit System32 folder.

Reply with quote

cs_280zx
Joined:
Posts:
4
Location:
Sydney

Hi, thank you for your suggestion, sorry for the delay many projects to manage at the moment. I will give your suggestions a go on monday and let you know the results.

thanks
carl

Reply with quote

cs_280zx
Joined:
Posts:
4
Location:
Sydney

Hi there,
I used the command
mklink "c:\scripts\linked\  c:\Windows\System32\certsrv\CertEnrol"
Now I changed the path in the txt file as follows:
# Connect to SFTP server PKI-02 using a password
open sftp://xxxxxxxx:xxxxx@xxxxx.replaceme.com.au/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" 
# Change remote directory *using a temp location*
cd /var/www/html/CertEnroll
# Upload file
put C:\scripts\linked\certenroll\*.crl
#
# Disconnect
close
# Exit WinSCP
exit

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum