I'm trying to run the following scrip on my WCF service hosted on my computer.
string exePath = "C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe";
var ps1 = new ProcessStartInfo();
ps1.FileName = exePath;
ps1.Arguments = "-ExecutionPolicy Bypass -File C:\\Users\\fn070084\\Desktop\\Test2.ps1";
ps1.WorkingDirectory = Path.GetDirectoryName(exePath);
Process.Start(ps1);
If I run just this code, it runs correctly on Visual studio, but when I put it on a service on the WCF server it's not doing something.
The code for the Test2 File is this one
$LogFile = "\\ComputerName\C$\powershellLog" + $LongTime + ".txt" "Hello, I'm running Powershell through C#" >>$logFile
Note: I wrote it as "ComputerName" but on my actual code I'm having the the rigth computer name.