Friday, 29 September 2017

Importing modules fails for C#.NET application - file cannot be loaded because running scripts is disabled on this system.

When you're tying to import a PowerShell script into a C#.NET application you may see an error like this
File C:\Program Files\WindowsPowerShell\Modules\AzureRM\4.4.0\AzureRM.psm1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

When you check the execution policy using Get-ExecutionPolicy it looks fine.



The issue here may be related to the application running in 32-bit mode, this has a different execution policy


No comments:

Post a Comment