C
Carlo Goretti
Guest
Hey Guys! Im trying to execute a powershell script from my C# program but dosent get it to work.. the script works fine in powershell but C# dont want to use it.. Any ideas?
Here is my C# code:
PowerShell ps = PowerShell.Create();
ps.Commands.AddScript(@"C:\Cago\powershell.ps1");
var resultat = ps.Invoke();
I just want to se that "resultat" gets something.. But its allways 0..
Here is my powershell code:
$Scheduler = New-Object -ComObject Schedule.Service
$Scheduler.Connect()
$RootFolder = $Scheduler.GetFolder("\")
$Task = $RootFolder.GetTask("testaktivitet")
$task.LastRunTime
#$Task.NextRunTime
Continue reading...
Here is my C# code:
PowerShell ps = PowerShell.Create();
ps.Commands.AddScript(@"C:\Cago\powershell.ps1");
var resultat = ps.Invoke();
I just want to se that "resultat" gets something.. But its allways 0..
Here is my powershell code:
$Scheduler = New-Object -ComObject Schedule.Service
$Scheduler.Connect()
$RootFolder = $Scheduler.GetFolder("\")
$Task = $RootFolder.GetTask("testaktivitet")
$task.LastRunTime
#$Task.NextRunTime
Continue reading...