Skip to content

TechRepublic

  • Top Products Lists
  • AI
  • Developer
  • Payroll
  • Security
  • Project Management
  • TechRepublic Academy
  • Innovation
  • Cheat Sheets
  • Cloud
  • 5G
  • Big Data
  • TechRepublic Premium
  • Top Products Lists
  • AI
  • Developer
  • Payroll
  • Security
  • Project Management
  • TechRepublic Academy
  • Innovation
  • Cheat Sheets
  • Cloud
  • 5G
  • Big Data
  • See All Topics
  • Sponsored
  • Newsletters
  • Forums
  • Resource Library
TechRepublic Premium
Join / Sign In
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 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

TechRepublic Premium

  • TechRepublic Premium

    Checklist: Network and systems security

    Cybersecurity demands and the stakes of failing to properly secure systems and networks are high. While every organization’s specific security needs form a unique and complex blend of interconnected requirements, numerous security fundamentals almost always apply to each of these groups. It stands to reason that cybersecurity pros who effectively identify network and systems risks ...

    Published:  June 1, 2023, 4:00 PM EDT Modified:  June 2, 2023, 7:48 AM EDT Read More See more TechRepublic Premium
  • TechRepublic Premium

    How to host multiple websites on Linux with Apache

    In this guide from TechRepublic Premium we’re going to explore the various things you can do with a Linux server. We won’t leave out any steps, so you won’t have to refer to another tutorial to complete the process. The only step we will leave out is the installation of Linux, as we’ll assume you ...

    Downloads
    Published:  May 31, 2023, 4:00 PM EDT Modified:  June 1, 2023, 7:45 AM EDT Read More See more TechRepublic Premium
  • TechRepublic Premium

    How to deploy an application with Kubernetes

    If you want to deploy applications into a Kubernetes cluster, be warned — it’s not the easiest task. There are a lot of moving pieces that go into these scalable containers. Don’t you wish you had a complete roadmap, from start to finish, to walk you through the process of deploying the Kubernetes cluster, deploying ...

    Downloads
    Published:  May 31, 2023, 4:00 PM EDT Modified:  June 1, 2023, 7:51 AM EDT Read More See more TechRepublic Premium
  • TechRepublic Premium

    Cross-training tool kit

    The more flexibility you can create in your technology workforce, the better you’ll be equipped to manage tomorrow, whatever the future brings. Too often, we focus on helping our teams become technical specialists who know volumes about a single technology, but quickly lose sight of how that technology connects with others. This makes their skills ...

    Downloads
    Published:  May 30, 2023, 4:00 PM EDT Modified:  May 31, 2023, 4:50 PM EDT Read More See more TechRepublic Premium

Services

  • About Us
  • Newsletters
  • RSS Feeds
  • Site Map
  • Site Help & Feedback
  • FAQ
  • Advertise
  • Do Not Sell My Information

Explore

  • Downloads
  • TechRepublic Forums
  • Meet the Team
  • TechRepublic Academy
  • TechRepublic Premium
  • Resource Library
  • Photos
  • Videos
  • TechRepublic
  • TechRepublic on Twitter
  • TechRepublic on Facebook
  • TechRepublic on LinkedIn
  • TechRepublic on Flipboard
© 2023 TechnologyAdvice. All rights reserved.
  • Privacy Policy
  • Terms of Use
  • Property of TechnologyAdvice