I hate to break bad news to you, but if the computer is turned off the scheduled task won't run. However, if the computer is sleeping - rather than powered off - you can schedule tasks to wake the computer.
If it misses a defrag schedule because the PC is off, it sometimes doesn't initiate even when the PC is on for the next scheduled time. Seems to be a bug in the scheduler or windows defragger. BTW, the windows defragger is not truly 'automatic' like some of the better commerical defraggers, it's just a low priority background defrag triggered on a schedule.
Hi solidstategamer, the default Windows defragmenter is the worst possible option to use both in terms of the time taken as well as functionality.
Depending on your usage and amount of data stored on your hard disk, it can take anything between 10 seconds to 5 minutes for a complete defrag for general home computers if done once a month or something.
Many people will suggest to you different utilities, but the best possible one these days without doubt is Auslogics Disk Defrag. Disable Windows Disk Defragmenter and download and install this one, and you'll not feel the need to have to 'schedule' defrag sessions anymore. As I said, depending on the amount of data and how fragmented your files are, it won't take any more than a minute on 99% of the home computers at most. (Using the 'optimize feature might take a few minutes more - but dont even bother with that, you'll never really need it)
Personally, I use Diskeeper, but it'll mostly be bloatware for most people & no one really needs it for regular home PC's. And why pay for something that can be had for free anyways?
I'm sorry if my post sounded a bit condescending, but seeing as you're even contemplating using the default defrag feature, I just had to give you an alternative.