E
Enric Vives
Guest
Hi there,
My aim is just check one Windows Tasks scheduled in my laptop and see if it ran or not from VSTA (one of my SSIS packages)
The name of this Windows Task is "Daily_R2"
any input would be greatly appreciated
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Management;
string wmiQuery = string.Format("SELECT Name, caption FROM Win32_ScheduledJob WHERE Name LIKE '{0}'","Daily_R2");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery);
ManagementObjectCollection retObjectCollection = searcher.Get();
foreach (ManagementObject retObject in retObjectCollection)
{
Console.WriteLine("[{0}]\tName: {1}", retObject["Name"], retObject["caption"]);
}
Dts.TaskResult = (int)ScriptResults.Success;
So, debugging this snippet of code never ever enter in foreach
Continue reading...
My aim is just check one Windows Tasks scheduled in my laptop and see if it ran or not from VSTA (one of my SSIS packages)
The name of this Windows Task is "Daily_R2"
any input would be greatly appreciated
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Management;
string wmiQuery = string.Format("SELECT Name, caption FROM Win32_ScheduledJob WHERE Name LIKE '{0}'","Daily_R2");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery);
ManagementObjectCollection retObjectCollection = searcher.Get();
foreach (ManagementObject retObject in retObjectCollection)
{
Console.WriteLine("[{0}]\tName: {1}", retObject["Name"], retObject["caption"]);
}
Dts.TaskResult = (int)ScriptResults.Success;
So, debugging this snippet of code never ever enter in foreach
Continue reading...