I have been running my code for past few months by doing this -
Set-ExecutionPolicy Unrestricted
But, something weird is happening and I am getting this error always -
Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of "Unrestricted". Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information, please see "Get-Help Set-ExecutionPolicy."
I have referred these links but no luck -
http://blog.whatsupduck.net/2010/09/issues-with-configuring-powershell.html
http://www.howtogeek.com/106273/how-to-allow-the-execution-of-powershell-scripts-on-windows-7/
I am loading the Powershell using C# on a 64-bit Windows 7 via a 32-Bit Winforms Application using .Net 4.0
What is the exact setting which I need to do such that I do not get this error on any system ? [Everything was working fine]. What should these values be on any system such that I am able to call Powershell from C# seamlessly -
Get-ExecutionPolicy -List
MachinePolicy UserPolicy Process CurrentUser LocalMachine
Get-ExecutionPolicy -List
should be showing you the execution policy per scope. – Keith Hill