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


Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.