Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

ibqadamani

It seems to work after a computer restart.
ibqadamani

Add-Type : Could not load file or assembly [Resolved]

Hi folks,

I have been trying for and looking through the forum threads for a solution but I keep getting the same issue.
I am trying to get Add-Type in PowerShell to work:
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"


but I get:
Add-Type : Could not load file or assembly 'file:///C:\Program Files (x86)\WinSCP\WinSCPnet.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

I unblocked the dll but I am still getting the same issue. I tried this also:
$assemblyPath = if ($env:WINSCP_PATH) { $env:WINSCP_PATH } else { $PSScriptRoot }
Add-Type -Path (Join-Path $assemblyPath "WinSCPnet.dll")


Specifications:
Windows 10
WinSCP-5.17.5
.NET Framework 4.7.3056
PowerShell version 5.1.17134.858