dlwyatt / PolicyFileEditor

PowerShell functions and DSC resource wrappers around the TJX.PolFileEditor.PolFile .NET class.
Apache License 2.0
189 stars 33 forks source link

Exception from HRESULT: 0x80131515 #6

Closed karezza closed 6 years ago

karezza commented 7 years ago

When I attempted to import:

PS > Import-Module PolicyFileEditor -Force Add-Type : Could not load file or assembly

I've unblocked the DLL. Turns out I can load the DLL with:

Add-Type -Path C:\users...\PolFileEditor.dll -ErrorAction Stop

.... Why is the module not able to load the dll?

erwinwildenburg commented 7 years ago

It works fine with me, no error.

dlwyatt commented 7 years ago

Does that continue to happen after you start a fresh PowerShell session? There's some caching that happens with regard to blocking / unblocking a file, as I recall.

karezza commented 7 years ago

This does appear to be the fix.

For some reason I had to open a new powershell and then I was able to import the module. Maybe it is as you said, because I had to unblock the DLL.

Thank you.