Skip to content

TechRepublic

  • Top Products
  • AI
  • Developer
  • Payroll
  • Security
  • Project Management
  • Accounting
  • CRM
  • Academy
Resources
  • TechRepublic Premium
  • TechRepublic Academy
  • Newsletters
  • Resource Library
  • Forums
  • Sponsored
Go Premium
Popular Topics
  • Top Products
  • AI
  • Developer
  • Payroll
  • Security
  • Project Management
  • Accounting
  • CRM
  • Academy
  • Project Management
  • Innovation
  • Cheat Sheets
  • Big Data
  • Tech Jobs
View All Topics
Go Premium
Enterprise Software

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

By Bill Detwiler May 15, 2006, 3:27 AM PDT Bill Detwiler on Twitter billdetwiler

Image
1
of 9

2959.jpg
2959.jpg
Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

© CNET Networks - Submitted by Joshua Hoskins

In this The Right Tool for the Job? post, Joshua Hoskins explains how he uses batch files and the Windows Task Scheduler to save time and effort when performing repetitive admin tasks.

Flush DNS Script

Shown here in Notepad, the Flush DNS Script will flush your DNS cache using the IPCONFIG command.

© CNET Networks - Submitted by Joshua Hoskins
Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Clear Bad Mail Script

This script will delete the contents of your IIS bad mail folder. The script uses the DEL command along with the quiet switch (/q) to prevent prompting for deletion.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Shutdown Script

When run, this reboots the host computer. The script uses two switches, /r which causes the system to reboot and not shutdown and /f which forces running applications to close. You can also use the shutdown command to shutdown remote computers.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

This script will stop and restart your SMTP service. Used with Windows Task Scheduler, you can easily restart services on a regular schedule. The script uses the NET command–an extremly useful Windows command line command.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Command Line Service Name

This screenshot shows the service properties for the World Wide Web Publishing Service. From this screen you can see the actual service name (W3SVC). You use this service name when you reference a service from the command line. For example, when stopping and restarting the SMTP service as in the SMTP Service Reset Script.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Scheduled Task Initial Schedule

From this wizard screen, you set your initial schedule for a job. You can apply multiple schedules from the Advanced dialog box.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Scheduled Task Authentication

You must enter authentication information for the task to run. Your scheduled task will run as the user you specify here. You must verify that the user account has sufficient permissions to complete the tasks in your batch file. If you are running commands against a remote machine (such as shutdown), this account must also have appropriate permissions on the remote machine.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Scheduled Task Advanced Screen

From the Advanced Properties first screen, you can change your authentication, alter where your batch file is located, enable or disable the task, and set the task to only run if the system running the task is logged in.

Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

Scheduled Task Advanced Screen 2

This is where many of the more advanced options for your task are. You can set the computer to automatically stop the task after a certain run time, only start or stop the task if the computer is idle, and configure options for the task based on your power settings.

  • Enterprise Software
  • Account Information

    Share with Your Friends

    Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler

    Your email has been sent

Share: Images: Automatically perform tedious admin tasks with batch files and Windows Task Scheduler
Image of Bill Detwiler
By Bill Detwiler
Bill Detwiler is the Editor for Technical Content and Ecosystem at Celonis. He is the former Editor in Chief of TechRepublic and previous host of TechRepublic's Dynamic Developer podcast and Cracking Open, CNET and TechRepublic's popular online show.
  • Account Information

    Contact Bill Detwiler

    Your message has been sent

  • |
  • See all of Bill's content

Daily Tech Insider

If you can only read one tech story a day, this is it.

TechRepublic TechRepublic
  • TechRepublic on Facebook
  • TechRepublic on X
  • TechRepublic on LinkedIn
  • TechRepublic on YouTube
  • TechRepublic on Pinterest
  • TechRepublic RSS
Services
  • About Us
  • Newsletters
  • RSS Feeds
  • Site Map
  • Site Help & Feedback
  • FAQ
  • Advertise
  • Do Not Sell My Information
  • Careers
Explore
  • Downloads
  • TechRepublic Forums
  • Meet the Team
  • TechRepublic Academy
  • TechRepublic Premium
  • Resource Library
  • Photos
  • Videos
  • Editorial Policy
  • Legal Terms
  • Privacy Policy
© 2025 TechnologyAdvice. All rights reserved.
CLOSE

Create a TechRepublic Account

Get the web's best business technology news, tutorials, reviews, trends, and analysis—in your inbox. Let's start with the basics.

Already registered? Sign In
Use Facebook
Use Linkedin

* - indicates required fields

CLOSE

Sign in to TechRepublic

Not a member? Create an account
Use Facebook
Use Linkedin

Lost your password? Request a new password

CLOSE

Reset Password

Please enter your email adress. You will receive an email message with instructions on how to reset your password.

Check your email for a password reset link. If you didn't receive an email don't forgot to check your spam folder, otherwise contact support.

Back to login
1 Finish Profile
2 Newsletter Preferences
CLOSE

Welcome. Tell us a little bit about you.

This will help us provide you with customized content.

No thanks, continue without
1 Finish Profile
2 Newsletter Preferences
CLOSE

Want to receive more TechRepublic news?

Newsletter Name
Subscribe
Daily Tech Insider
Daily Tech Insider AU
TechRepublic UK
TechRepublic News and Special Offers
TechRepublic News and Special Offers International
Executive Briefing
Innovation Insider
Project Management Insider
Microsoft Weekly
Cloud Insider
Data Insider
Developer Insider
TechRepublic Premium
Apple Weekly
Cybersecurity Insider
Google Weekly
Toggle All
No thanks, continue without

You're All Set

Thanks for signing up! Keep an eye out for a confirmation email from our team. To ensure any newsletters you subscribed to hit your inbox, make sure to add [email protected] to your contacts list.

Back to Home Page
×