Topic "Cannot Load Assembly in powershell"

Author Message
[View user's profile]

Joined: 2012-05-30
Posts: 2
Location: TN
Hey everyone,

Ive downloaded the files and followed the directions to the best of my ability, but am having trouble loading the WinSCP.dll into my powershell application. I downloaded the portable package and the dll and put them in my pwd. Basically my structure looks like this:


When I execute My-Powershell.ps1 out of the .\Bin directory and call the line
[Reflection.Assembly]::LoadFrom("Full Path to WinSCP.dll") and I get the following error.

Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Users\PATH TO WinSCP.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT:
At C:\PATH TO My-PowershellScript.ps1.ps1:16 char:40
+ [System.Reflection.Assembly]::LoadFrom <<<< ("C:\Users\PATH TO WinSCP.dll") | Out-Null
+ CategoryInfo : NotSpecified: (Smile [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

I've read the documentation over and again, and ive looked at all the other threads on loading .dlls into powershell and can't make any headway. Anybody have any ideas for help?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
What packages have you downloaded (exact names)? What version of .NET do you have installed?
[View user's profile]

Joined: 2012-05-30
Posts: 2
Location: TN
Um, in C:\Windows\Microsoft.NET\Framework I have v1.0.3 v1.1.4 v2.0.5 v3.0 v3.5 v4

From powershell [System.Reflection.Assembly]::GetExecutingAssembly().ImageRuntimeVersion yields v2.0.50727

I have in my pwd WinSCP.exe and from version 5.0.7 and WinSCP.dll from the same.

For what its worth, I am receiving this update when I execute this script from PowerGUI script editor, I do not receive the error when I run from powershell command line. There must be something I have misconfigured in PowerGUI. When I made this post, I hadn't tried running from powershell command line. Shocked

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License