Topic "Add-type in Powershell not working"

Author Message
[View user's profile]

Joined: 2014-02-25
Posts: 4
I have installed WinSCP v.5.7.7. in C:\Program Files (x86)\WinSCP\ and unlocked the WinSCPNet.dll as documented, but when I enter Add-Type -Path "WinSCPnet.dll" in Powershell it still fails:

Add-Type : Could not load file or assembly 'file:///C:\Windows\system32\WinSCPnet.dll' or one of its
dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
+ Add-Type -Path "WinSCPnet.dll"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeComma

This is a new Windows 2012R2 server. I need this to work as I have to convert all of my VBS scripts that call WinSCP to Powershell scripts ASAP.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25310
Location: Prague, Czechia
Why are you loading the assembly from C:\Windows\system32\WinSCPnet.dll?

Show us your code!
[View user's profile]

Joined: 2014-02-25
Posts: 4
I found the correct syntax:
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"

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