Q:

Create Task Scheduler (for running in machine restart) using MsBuild

I use VS 2008, .NEt 3.5, and MsBuild, and I need custom task MsBuild that create a "task scheduler" that it will run when the machine restarted. 
Anyone know any custom tasks in MsBuild Extensions or has any sample code about it?

A:

I don't know of any task, but you can just use the Exec task for this. For example here is a simple usage of it for your case.

<PropertyGroup>
  <Time>23:27</Time>
  <CommandToExecute>SCHTASKS /Create /SC ONCE /TN tempTaskName /ST $(Time) /F /TR notepad</CommandToExecute>
</PropertyGroup>

<Target Name="Demo">
  <Message Text="Scheduling task" />
  <Exec Command="$(CommandToExecute)"/>
</Target>

This will create a new scheduled task named 'tempTaskName' for 11:27 PM.
The result in my case is:

http://msdn.microsoft.com/en-us/library/x8zx72cd.aspx

