I am trying to read the Version from a DLL using Powershell using this code:
Add-Type -Path "\\myuncpath\my.dll"
$version = [MyProd.MyVersion]::CurrentProductVersion + '.' + [MyProd.MyVersion]::CurrentBuild
It works on all of my server except one. On this one I am getting the following error:
Add-Type : Die Datei oder Assembly "file://\\myuncpath\my.dll" oder eine Abhängigkeit
davon wurde nicht gefunden. Der Vorgang wird nicht unterstützt. (Ausnahme von HRESULT: 0x80131515)
In Zeile:1 Zeichen:1
+ Add-Type -Path "\\myuncpath\my.dll"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
Sorry for it being German but I guess sole the stack trace will help out as well.
I was already comparing the config files on the different servers but there was no difference. I am not knowing of different settings on the server but I guess there has to be one.
I already tried to use Unblock-File
, set <loadFromRemoteSources enabled="true" />
in the config and also Set-ExecutionPolicy RemoteSigned
.
However nothing worked.
It is should be important to know, that if I copy the file to my local machine and change the name of the file I can access it.
I hope I am missing out onto something dumb. Thanks in advance for your help.
User contributions licensed under CC BY-SA 3.0