i ran into an issue while using this code to include some local dll.
Add-Type -Path "c:\temp\some.dll"
This will work on some machine and fail on some machines. All of those have been installed with the same W10 image, they also use the same policies. All have unrestricted Execution Policies and the same Powershell Version 5.1. There is no difference between 32 and 64-bit machines. Affected devices will throw a "permission denied" error and we have switched dll files and path and made sure we have access rights and the ISE is running as admin. Additionally i have checked that all machines are using the same .Net version. On working machines the Type will be added without error.
I tried to "break" my config so i will get the same error but was not successful yet. As i am running out of ideas i would appreciate very much any hint on where to search next or what to test. Thank you all in advance !
We have found out that, on affected machines, a hidden value was used to set the LanguageMode to Restricted.
$__PSLockDownPolicywas set to 4 in the system environment parameters. Change that to 8 and the permission denials are gone.