2013-12-19 5 views

답변

3

네이티브 COM 인터페이스 주위에 래퍼를 만들어야합니다. 직접하고 싶지 않다면이 라이브러리를 사용할 수 있습니다. https://taskscheduler.codeplex.com

using System; 
using Microsoft.Win32.TaskScheduler; 

class Program 
{ 
    static void Main(string[] args) 
    { 
     // Get the service on the local machine 
     using (TaskService ts = new TaskService()) 
     { 
     // Create a new task definition and assign properties 
     TaskDefinition td = ts.NewTask(); 
     td.RegistrationInfo.Description = "Does something"; 

     // Create a trigger that will fire the task at this time every other day 
     td.Triggers.Add(new DailyTrigger { DaysInterval = 2 }); 

     // Create an action that will launch Notepad whenever the trigger fires 
     td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null)); 

     // Register the task in the root folder 
     ts.RootFolder.RegisterTaskDefinition(@"Test", td); 

     // Remove the task we just created 
     ts.RootFolder.DeleteTask("Test"); 
     } 
    } 
} 
+1

버튼을 VB에서 클릭하면 컴퓨터에 로그인 한 현재 사용자를 로컬 관리자 그룹에 1 시간 추가하는 작업을 예약하는 코드를 빌드 할 수 있습니까? 그 다음 시간 이후에 제거됩니다. –

+0

모든 것이 가능하지만 일부 Windows 보안 메카니즘을 이해해야합니다 – meziantou

+0

코드 플렉스 링크가 이제 종료되었습니다. – Smith