System.Management.Automation.CmdletInvocationException: File \\Server\ps.ps1 cannot be loaded. The file \\Server\ps.ps1 is not digitally signed. The script will not execute on the system. For more information, see about_Execution_Policies athttp://go.microsoft.com/fwlink/?LinkID=135170. --->
So if I run the command from Powershell ISE it works, when I call it from a c# application I get the above error.
From powershell
PS E:\Power> Get-ExecutionPolicy
Unrestricted
I have also added the following registry keys to the machine that is being used to call the local script and the remote machine.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\ShellIds\Microsoft.PowerShell\ExecutionPolicy = Unrestricted
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy = Unrestricted
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\ScriptedDiagnostics\ExecutionPolicy = Unrestricted
Also the remote powershell file is not blocked.
Any ideas?