Search notes:

PowerShell cmdLet Unblock-File

unblock-file removes a file's Zone.Identifier alternate data stream whose value of 3 (?) indicates that the file was downloaded from the internet and is possibly unsafe to run.
After unblocking a file, it can be run even if execution policy is set to RemoteSigned.
unblock-file might also be used to execute a PowerShell script that was downloaded from a trusted location and trying to execute the script results in the error message script cannot be loaded. The file … is not digitally signed. You cannot run this script on the current system.

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

See also

Set the Zone.Identifier stream in a file to simlate a file being downloaded from the Internet.
Error message: The 'xxx' command was found in the module 'xxx', but the module could not be loaded.
Powershell command noun: executionPolicy
Powershell command noun: file

Index