Hi
I have set Execution policy to RemoteSigned for LocalMachine as well as CurrentUser scope. However when my application is running powercli commands using sdk, I am getting following error -
"File C:\Program Files\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\VMware.VimAutomation.Sdk.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."
1) OS - Windows Server 2012 Standard
2) PowerShell Version -
$PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
Also tried by upgrading Powershell version to 5.1. It throws same error.
3) Get-PowerCLIVersion
PowerCLI Version
----------------
VMware PowerCLI 11.5.0 build 14912921
---------------
Component Versions
---------------
VMware Common PowerCLI Component 11.5 build 14898112
VMware Cis Core PowerCLI Component PowerCLI Component 11.5 build 14898113
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.5 build 14899560
Then I tried doing this setting in code for each connection I make, I don't see the error then.
Since the setting is global, want to avoid it setting through code. Any clue to why the natively done setting is not persistent through multiple sessions?
Thanks in advance.
Could it be that there a Group Policy setting the ExecutionPolicy in your environment?
Check you GPOs or talk to your Windows/AD administrators
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes. Setting from GPO helped.
I was setting it for User configuration. Setting it for Computer configuration resolved the issue.
Thanks for the help.