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

rcmartin@apu.edu

Re: PowerShell v4.0 Add-Type fails

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

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.
rcmartin@apu.edu

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