Lets ignore that periodically rebooting server a DC is generally a bad idea, and shouldn't be required. Lets just focus on the part of your question about schedule tasks, and managing password for the account you use.
The answer to your core question is that in recent versions of Windows you are supposed to use Managed Service Accounts. Of course if your task doesn't need any access on the network at all, and you aren't worried too much about security, you could also set it to run as the system account.
Managed service accounts are a feature that permit you to use an account without knowing or manage the password at all. Windows will handle this for you.
Using a managed service account isn't easy, but here an tutorial that shows using a managed service account with a schedule task.