Demonstration
PS C:\> $dll = 'C:\oracle\18c\ODP.NET\managed\common\Oracle.ManagedDataAccess.dll'
PS C:\> add-type -path $dll
add-type : Could not load file or assembly 'file:///C:\oracle\18c\ODP.NET\managed\common\Oracle.ManagedDataAccess.dll'
or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
…
Verifying if the
DLL has the
Zone.Identifier alternate stream which causes the error:
PS C:\> (get-item $dll -stream zone.identifier -errorAction silentlyContinue).length
103
Open the DLL's property dialog:
PS C:\> (new-object -com shell.application).nameSpace((split-path $dll)).parseName((split-path -leaf $dll)).invokeVerb('properties')
Unblock the DLL
PS C:\> unblock-file $dll
PS C:\> (get-item $dll -stream zone.identifier -errorAction silentlyContinue).length
0
PS C:\> (new-object -com shell.application).nameSpace((split-path $dll)).parseName((split-path -leaf $dll)).invokeVerb('properties')
After unblocking the file, the unblock checkbox is gone from the file's property dialog:
The DLL can now be added:
PS C:\> add-type -path $dll