PowerShell v4.0 Add-Type fails

Advertisement

rcmartin@apu.edu
Joined:
Posts:
2
Location:
Azusa, California

PowerShell v4.0 Add-Type fails

I had this working in PowerShell 2.0 but when I upgraded to v4 it started failing:
Add-Type -Path "WinSCPnet.dll"

This now returns the error:
Error: Could not load file or assembly 'file:///C:\APUDATA\WinSCPnet.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

I noticed that the upgrade to PowerShell v4 also required installing .NET Framework 4.5. I saw another post where you said you can't work with .NET 4.0, so is 4.5 also a problem? If so do you have a workaround?

Ray Martin

Reply with quote

Advertisement

Rob@Sask
Joined:
Posts:
1
Location:
Saskatchewan

I ran into this as well.

Aside from the above tip about the dll protection, I had to run the command: "Enable-PSRemoting -Force" . I run in a secure environment so I recommend reading up on that command before using (if so required).

R.

Reply with quote

rcmartin@apu.edu
Joined:
Posts:
2
Location:
Azusa, California

Re: PowerShell v4.0 Add-Type fails

Removing the Windows file attribute that blocks downloaded Internet files did the trick. Thank you very much!

Reply with quote

Advertisement

You can post new topics in this forum