Add-Type load assembly from network UNC share error 0x80131515

0
0

When you want to add an assembly from a network UNC share using the command:

$scriptPath = Split-Path ($MyInvocation.MyCommand.Path)
Add-Type -path "$scriptPath\selenium-dotnet\net40\WebDriver.dll"

you might face such an error:

Add-Type: Could not load file or assembly 'file:///Z:\A-Backup\Users\Administr
ator\Desktop\MAXIMO Automatic\selenium-dotnet\net40\WebDriver.dll'
or one of it
s dependencies
. Operation is not supported. (Exception from HRESULT: 0x80131515
)
At Z:\A-Backup\Users\Administrator\Desktop\MAXIMO Automatic\MAXIMO Automatic.ps
1:14 char:1
+ Add-Type -path "$scriptPath\selenium-dotnet\net40\WebDriver.dll"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell
.Commands.AddTypeCommand

How can I fix this problem?

  • You must to post comments
0
0

The key is to allow for loading an assembly from a network path for a PowerShell executable. It can be done by creating the two files

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.config C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe.config

and paste this code:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>
  • You must to post comments
0
0

dating online here [url=”http://manssecreto.pro”] dating [/url] site http://manssecretw.pro

  • You must to post comments
Showing 2 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website