C
Carlo Goretti
Guest
Hey Guys!
I have tryied to implement this Powershell Code to C#:
$Root = "\";
$Taskname = "L&T Integration"
$Scheduler = New-Object -ComObject Schedule.Service
$Scheduler.Connect()
$RootFolder = $Scheduler.GetFolder($Root)
$Task = $RootFolder.GetTask($Taskname)
$task.LastRunTime
$Task.NextRunTime.DateTime
$task.Enabled
Right now i have this in a seperated script that im reading in..
I want to implement it to c# code so i can set parameters like $TaskName and $Root from C# code..
Here is my C# Code:
string skript = File.ReadAllText(@"C:\Cago\taskSchedulerPS.ps1");
PowerShell ps = PowerShell.Create();
ps.Commands.AddScript(skript);
var resultat = ps.Invoke();
Any Ideas?
Best Regards
Continue reading...
I have tryied to implement this Powershell Code to C#:
$Root = "\";
$Taskname = "L&T Integration"
$Scheduler = New-Object -ComObject Schedule.Service
$Scheduler.Connect()
$RootFolder = $Scheduler.GetFolder($Root)
$Task = $RootFolder.GetTask($Taskname)
$task.LastRunTime
$Task.NextRunTime.DateTime
$task.Enabled
Right now i have this in a seperated script that im reading in..
I want to implement it to c# code so i can set parameters like $TaskName and $Root from C# code..
Here is my C# Code:
string skript = File.ReadAllText(@"C:\Cago\taskSchedulerPS.ps1");
PowerShell ps = PowerShell.Create();
ps.Commands.AddScript(skript);
var resultat = ps.Invoke();
Any Ideas?
Best Regards
Continue reading...