Win7 PowerShell Could not load file or assembly winscpnet.dll

Advertisement

wontolla
Joined:
Posts:
2
Location:
Mexico

Win7 PowerShell Could not load file or assembly winscpnet.dll

Hi, this is my first post.
I am from Mexico and this is my first try integrating WinSCP for an automation FTP tasks.

To this point I am successfully working with WinSCP and Win10 PowerShell script to upload and download files from an FTP server.

But I tried this on a Win7 PC and it is not working. Same WinSCP version and same PowerShell script. But when I tried to upload a file I got error:
Could not load file or assembly winscpnet.dll
If I try to upload the file using the WinSCP program it works fine.
I tried to install the assembly, with no success.

I am using this PowerShell script:
# Carga del ensamblado .NET para WinSCP
add-type -Path 'C:\Program Files (x86)\WinSCP\WinSCPnet.dll'
 
# Configuración de opciones de sesión
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Ftp
    HostName = "server"
    UserName = "user"
    Password = "pass"
}
 
$sessionOptions.AddRawSettings("AddressFamily", "1")
$session = New-Object WinSCP.Session
 
try
{
    # Conexión
    $session.Open($sessionOptions)
 
    # Transferir archivos
    $session.GetFiles("/empa/EXIS_EMPA.xlsm", "C:\PEDIDO_EMPA\*").Check()
}
finally
{
    $session.Dispose()
}
Any suggestion, please?

Best Regards

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
42,276
Location:
Prague, Czechia

Re: Win7 PowerShell Could not load file or assembly winscpnet.dll

You didn't post complete error message, so it's hard to help. You might be having one of these problems:
If neither helps, please post complete exact error message.

Reply with quote

Advertisement

You can post new topics in this forum