PROBLEM:
I am not able to add the
WinSCPnet.dll
type to my PowerShell script and would appreciate any advice you could offer to help me resolve this issue. Based on a review of the other posts in this forum, I have removed the block on
WinSCPnet.dll
in Windows Explorer and I have ensured
WinSCP.exe
is located in the same folder as the DLL.
MY CODE:
Add-Type -Path "C:\Program Files (x86)\WinSCP\WINSCP.NET\WinSCPnet.dll"
ERROR:
Add-Type : Could not load file or assembly 'file:///C:\Program Files
(x86)\WinSCP\WINSCP.NET\WinSCPnet.dll' or one of its dependencies. Operation is not supported.
(Exception from HRESULT: 0x80131515)
FWIW, I was able to create a C# console application that included a reference to
"C:\Program Files (x86)\WinSCP\WINSCP.NET\WinSCPnet.dll"
after I manually added
WinSCP.exe
to the project. This test leads me to believe my problem my be unique PowerShell. But, I'm not sure what else to check.
UPDATE:
I was able to resolve this problem by using a utility called "Streams" from Microsoft's SYSINTERNALS to permanently unblock these two files. This seems a bit extreme; however, it resolved my problem.