Home > Batch Scripting, Microsoft, NT Backup, Scripting > NtBackup Part:2 schedueling a task via cmd.

NtBackup Part:2 schedueling a task via cmd.

As part of an ntbackup script i began recently, I needed to look at how to schedule tasks from remotely. I had some experience using at.exe but seeing as schtasks seems to be the new tool i decided to give it a lash.

Almost immediately i ran into problems, if i was to specify a username and password for the job to run as, the script demanded a system name… why ask for a system name if you want to run it locally i wondered, but with using the %computername% variable it allowed me to run this locally.

schtasks /create /s \\%computername% /u domain\username /p Password /tn Server-Backup /tr “c:\backup.bat” /sc daily /st 09:00:00

the above schedules backup.bat to run as whatever user you specify, it will display as “Server-Backup” in scheduled tasks and will run daily for ever.

Below is an example of what you should see in scheduled tasks:

Check the next post for information on how to roll this out to multiple servers.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: