{"action":"created","issue":{"url":"https://api.github.com/repos/michaelburns/LaunchPad/issues/5","labels_url":"https://api.github.com/repos/michaelburns/LaunchPad/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/michaelburns/LaunchPad/issues/5/comments","events_url":"https://api.github.com/repos/michaelburns/LaunchPad/issues/5/events","html_url":"https://github.com/michaelburns/LaunchPad/issues/5","id":119601504,"number":5,"title":"Problem with Powershell Executionpolicy","user":{"login":"ducke","id":708405,"avatar_url":"https://avatars.githubusercontent.com/u/708405?v=3","gravatar_id":"","url":"https://api.github.com/users/ducke","html_url":"https://github.com/ducke","followers_url":"https://api.github.com/users/ducke/followers","following_url":"https://api.github.com/users/ducke/following{/other_user}","gists_url":"https://api.github.com/users/ducke/gists{/gist_id}","starred_url":"https://api.github.com/users/ducke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ducke/subscriptions","organizations_url":"https://api.github.com/users/ducke/orgs","repos_url":"https://api.github.com/users/ducke/repos","events_url":"https://api.github.com/users/ducke/events{/privacy}","received_events_url":"https://api.github.com/users/ducke/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/michaelburns/LaunchPad/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-30T23:03:15Z","updated_at":"2015-12-01T21:35:32Z","closed_at":null,"body":"I have a problem with the execution policy on my Windows 10 machine.\r\n\r\nThis is my Testcode:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/708405/11487107/560b333e-97bd-11e5-8af4-988167a72ea1.png)\r\n\r\nIt fails with this error:\r\n```csharp\r\nSystem.Management.Automation.PSSecurityException was unhandled by user code\r\n  HResult=-2146233087\r\n  Message=File C:\\Alchemy\\Scripts\\TestMe.ps1 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.\r\n  Source=System.Management.Automation\r\n  WasThrownFromThrowStatement=false\r\n  StackTrace:\r\n       at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin, PSHost host)\r\n       at System.Management.Automation.CommandDiscovery.ShouldRun(ExecutionContext context, PSHost host, CommandInfo commandInfo, CommandOrigin commandOrigin)\r\n       at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(CommandInfo commandInfo, CommandOrigin commandOrigin, Nullable`1 useLocalScope, SessionStateInternal sessionState)\r\n       at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)\r\n       at System.Management.Automation.CommandFactory._CreateCommand(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)\r\n       at System.Management.Automation.Runspaces.Command.CreateCommandProcessor(ExecutionContext executionContext, CommandFactory commandFactory, Boolean addToHistory, CommandOrigin origin)\r\n       at System.Management.Automation.Runspaces.LocalPipeline.CreatePipelineProcessor()\r\n       at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()\r\n       at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()\r\n  InnerException: \r\n       HResult=-2147024891\r\n       Message=File C:\\Alchemy\\Scripts\\TestMe.ps1 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.\r\n       InnerException: \r\n```\r\nMy executionpolicy:\r\n![image](https://cloud.githubusercontent.com/assets/708405/11486361/fd9818ba-97b8-11e5-91dc-10bfb5b3b7ad.png)\r\n\r\nI'm running your project from VS Professional 2015 with IIS Express.\r\n\r\nI found a solution for this problem in this blog http://www.nivot.org/blog/post/2012/02/10/Bypassing-Restricted-Execution-Policy-in-Code-or-in-Script\r\n\r\n```csharp\r\n            // Executionpolicy Bypass\r\n            // \r\n            InitialSessionState initial = InitialSessionState.CreateDefault();\r\n\r\n            // Replace PSAuthorizationManager with a null manager\r\n            // which ignores execution policy \r\n            initial.AuthorizationManager = new\r\n                  System.Management.Automation.AuthorizationManager(\"Microsoft.PowerShell\");\r\n\r\n            //Create Runspace\r\n            Runspace runspace = RunspaceFactory.CreateRunspace(initial);\r\n```"},"comment":{"url":"https://api.github.com/repos/michaelburns/LaunchPad/issues/comments/161102877","html_url":"https://github.com/michaelburns/LaunchPad/issues/5#issuecomment-161102877","issue_url":"https://api.github.com/repos/michaelburns/LaunchPad/issues/5","id":161102877,"user":{"login":"ducke","id":708405,"avatar_url":"https://avatars.githubusercontent.com/u/708405?v=3","gravatar_id":"","url":"https://api.github.com/users/ducke","html_url":"https://github.com/ducke","followers_url":"https://api.github.com/users/ducke/followers","following_url":"https://api.github.com/users/ducke/following{/other_user}","gists_url":"https://api.github.com/users/ducke/gists{/gist_id}","starred_url":"https://api.github.com/users/ducke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ducke/subscriptions","organizations_url":"https://api.github.com/users/ducke/orgs","repos_url":"https://api.github.com/users/ducke/repos","events_url":"https://api.github.com/users/ducke/events{/privacy}","received_events_url":"https://api.github.com/users/ducke/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T21:35:32Z","updated_at":"2015-12-01T21:35:32Z","body":":+1: "}}