Administrative Tools comes with a list of mini-apps to work with, but the Computer Management option provides a grouping of tools in one console. It may not be the super console you would like to have (which you can create if you like), but it is a decent toolset collection.
The Computer Management tool, shown in Figure 3.3, allows you to manage local or remote systems through one console. You can monitor system events, work with hard disks, manage performance, schedule tasks, and so on.
Figure 3.3 The Computer Management console includes a bevy of tools.
Under System Tools, the following are available:
- Task Scheduler—Create and manage common tasks that your computer will carry out either automatically, or at the times you specify.
- Event Viewer—Used to view logs about events associated with file and directory replication, DNS, security, and more.
- Shared Folder—Categories include: Shares—Used to create shares and list all system shares. Sessions—Any open session from the local computer or a remote computer is listed. Open Files—Files being used by users or other computers are listed.
- Local Users and Groups—Used to make user and group accounts on the local computer.
- Reliability and Performance—Provides preconfigured diagnostics of your systems reliability and performance. You can also define your own counters to watch in real time or over a predefined period.
- Device Manager—Used to view all system resources.
Under Storage you'll find this option:
- Disk Management—Used to create, format, or delete simple, spanned, mirrored, striped, or RAID-5 volumes. Also provides information about the disk regarding the status and health.
Under Service and Applications are the following:
- Services—Lists all services (started or not) and the Startup Type (Automatic, Manual, or Disabled).
- WMI Control—Windows Management Instrumentation control allows monitoring and controlling system resources.
We've already discussed Local Users and Groups. Reliability and performance (in Chapter 8, "System Recovery and Diagnostic Tricks"), as well as disk management (in Chapter 5), are discussed later, while Device Manager was discussed in Chapter 2. This section discusses Task Scheduler, Event Viewer, and Services.
Vista really gives the Task Scheduler a much-needed overhaul. Now you can configure the Scheduler to perform tasks on a timed basis and to respond to situations that occur on a variety of levels. The response system can even restart a service that has failed or send an email to the admin when a certain event has occurred.
The Task Scheduler is integrated with Event Viewer now so that it can react to situations based on trackable events that occur. There is also a way to view the task history. You can see which tasks are running, have run, or are scheduled to run.
In addition, an entire Task Scheduler Library has preconfigured tasks with which you can work (see Figure 3.4).
Figure 3.4 The Task Scheduler has an entire library of options, or you can create your own using the basic options or the more advanced tabular dialog box.
Triggers and Actions
A trigger is what causes the task to run, and an action is what you have configured to occur in the event the trigger goes off. Some triggers are schedules you put into effect. For example, if you specify that every day at 1:00 p.m. a certain action should occur, the trigger is the scheduled time. But a trigger can also be when a user logs on, when the system starts up, when a specific event occurs, and so forth. An action is whatever task the system executes in response to the trigger. Actions can include running a program, sending an email, or even displaying a preconfigured message. There is a list of possible actions to take, including running scripts with the cscript.exe application, copying a file with Robocopy, starting and stopping services, shutting down the system, and a host of others.
Scheduling a Task
You can do this in several ways. First, from the console, you can open the Actions pane and select Create Basic Task. This walks you through the following options:
- Create a Basic Task—Start with a name and description.
- Trigger—You can work from a schedule (daily, weekly, monthly, one time) where you set time parameters for the triggered event. You can also select When the Computer Starts, When I Log On, or When a Specific Event Is Logged. In the case of the latter, you can select the Log, the Source, and even the Event ID that triggers the next step.
- Action—You can start a program (and choose which program that is), send an email (with the information for the email), or display a message (and write the message you want displayed).
- Finish—You can review your new task and tell it to open the properties of the task. When this happens, you can see a much more complicated tabbed view of a task. These options help you go beyond the basic task. You can create and manage your tasks in this way, or you can create a task from the more complicated tabs to start with.
To create a task that goes beyond what you can do when creating a Basic Task, select the Create Task option from the Action pane. This offers a dialog box with five tabs to configure your tasks. The tabs include the following:
- General—Enables you to configure the name and description of the task, under which user account it should run, and whether it should run only when that user is logged on or not.
- Triggers—Here you can schedule an extensive list of triggers, starting with the time triggers you can set up. If you change the Begin the Task options, the settings will. The most complex of the triggers involves Events.
- Actions—The actions you can perform are no different here from what they were from the basic settings. You can configure a program to run, send an email, or display a message: Or you can do all three if you like. That is the benefit to using the advanced tabbed task creator. You can configure different actions to occur from here.
- Conditions—This tab enables you to specify conditions to your task. For example, you may want certain tasks to run only if the system is idle. Other conditions might depend on whether the computer is running on AC power or battery power, or if it is or isn't connected to a specific network.
- Settings—Allows you to determine whether you can start the task manually, what to do if your task couldn't run on schedule, what to do in the event a task is running too long, and so on.
Importing and Exporting Tasks
All of a task's properties (triggers, actions, conditions, settings) are held in XML files. You can export these XML files and import them on other systems.
Importing is quite simple; you can see the import option on the Action pane while working with the task manager. To see the export option, you must open the Task Scheduler Library folder. You can export the tasks you have created or export the preconfigured tasks within the library (although this would make sense only if you have configured them differently in some way). To export a task you select the task, right-click and choose to export. Choose the location for the .xml file that will be created. To import you can right-click any of the task folders and choose import task and then select the .xml file you want to import.
The AT Scheduler, Command Prompt Options, and Scripting
The AT command is the tool that was historically used to schedule tasks through the command-line in previous versions of Windows. Call it nostalgia, but for some reason Microsoft hasn't removed the at.exe command from Vista even though it has replaced it with the schtasks.exe command. What does this mean? Well, if you have worked with the AT command for many years and are comfortable using it, you can still use it in Task Scheduler. All tasks created with the at.exe command must run on the same account, which you can configure through the AT Service Account Configuration option from the Actions pane.
But, if you want to work with the latest tool, the schtasks.exe command enables you to do many of the same operations on local or remote systems. You can create, delete, query, change, run, and end scheduled tasks. Type one of the following commands for help on using schtasks.exe:
schtasks /Create /? schtasks /Run /? schtasks /End /? schtasks /Delete /? schtasks /Change /?
Scripting the Task Scheduler has been made more fun now that you can go beyond at.exe and even schtasks.exe. With Vista, you can access the Task Scheduler API through scripts. Microsoft provides a nice article on this at http://www.microsoft.com/
This article walks you through the beginning stages of scripting the task scheduler, and whoever wrote it is more than intelligent, but knows how to take dry-programming-speak and turn it into a fun article.
Having Some Fun with the Task Scheduler
Fun? Are Vista Masters allowed to have fun? Well, in addition to saving the universe, we need to enjoy our work. Here are some fun things to try with your Task Scheduler:
- Need your religious or comedic fix in the morning? You can also set the task scheduler to start up an installed Daily Scripture program, or a set Bible reader, or if comedy is more your needed wake-me-up go to the Calvin and Hobbes site (or whatever comics make you happy).
- Need an expensive alarm clock? Set Task Scheduler to start up one of your music applications to open and play your favorite songs (or if you are a heavy sleeper, you can have a Godzilla MP3 set to go off, too). Want to live the movie Groundhog Day? Set the Sonny and Cher song "I've Got You Babe" to go off the same time every day?
- Make coffee and pick up your dry cleaning? Sorry, perhaps in the next version of Windows.
Note that because this command closes all applications and then reboots the system you might want to have a task run that restarts certain applications—perhaps your email client or an Office application you use every day.
The Vista Event Viewer
We've been using Event Viewer for years, but most people check it only when there is a major problem. They see if they can quickly discover which service stopped or what caused the glitch; then they forget about it again until the next big problem. This is not truly taking advantage of the powerful technology at our fingertips. Although upon first look, Vista's Event Viewer can appear overwhelming, let's see if we can tame it a bit.
The Event Viewer (shown in Figure 3.5) enables you to see more than the standard Windows logs (Application, System, and Security logs). Now there are Applications and Services logs, which include diagnostic logs, logs for specific applications within Vista, like your IE logs. In the past, you had to hunt to find logs for certain applications, but Microsoft has tried to bring them all together here.
Figure 3.5 The Vista Event Viewer is more robust, offering an Enterprise monitoring functionality.
Custom Views: More Than Filters
So many events come into the Event Viewer that it's almost impossible to track down the problem you are investigating without some form of filter. Views allow you to create filters that not only filter the events of one log, but also enable you to select multiple logs to view. To create a custom view, you select a log, open the Action pane, and select Create a Custom View, shown in Figure 3.6.
Figure 3.6 Creating a custom view and choosing the logs included.
From the Custom View dialog box, you can configure the following options:
- Logged—Enables you to provide a time frame for the events.
- Event Level—Critical, Warning, Error, Information, and Verbose.
- By Log—Select the Event log or logs from a checkbox hierarchy.
- By Source—Select from a source hierarchy, including applications and services.
- Event IDs—If you know the specific ID you are looking for, you can put it here or enter several IDs separated by commas.
- Task Category and Keywords—Select from the checkboxes that drop down. Filtering by keywords is a new feature we can all appreciate.
- Users and Computers—You can have the view look for specific users and can even filter through multiple computers.
XML Event Viewer Details
XML is everywhere in Vista. Event Viewer is no exception. If you look at the properties of an event, you will be met with a scary-looking XML structure (shown in Figure 3.7). You can switch over to the Friendly View if that makes you feel better.
Figure 3.7 XML is everywhere in Vista, including Event Viewer details.
Why is the information stored as XML? It makes it easier for applications to take advantage of it for centralization and consolidation of the data. Other applications such as Microsoft Operations Manager (MOM) and Systems Management Server (SMS) (and others that are in the works) can take advantage of the XML open-sourced format of the data.
You can right-click any event and choose "Event Properties" to obtain more information. From the Properties, the General details provide the information you most need to troubleshoot that particular event, if the event indicates a problem with your system. You'll notice that you still have the ability to request help from Microsoft through the Event Log Online Help option, which usually says something like, "Sorry, even though we created the program we have no how idea to help you we're really, really sorry." Okay, so it doesn't say that, but it is frustrating much of the time.
You can collect logs from remote systems and save them onto your local system through subscriptions. For this to work, you have to configure the collector (the system that collects the events) and the remote source systems.
To configure the source systems, type the following command from an elevated command prompt
To configure the collector computer, type the following command from an elevated command prompt
On the source computers you will need to add the computer account of the collector to the local Administrators group on each computer.
After the systems are configured to forward and collect events, you can create new subscriptions through the Event Viewer. There are more details you might need to consider depending on your environment, such as opening ports for your firewall to allow the event management exception and so forth. Going through the Help information from the Event Viewer offers a great deal of information on how-to advice and troubleshooting problems.
Services and the SC.exe Command
Services are the underlying core OS features that handle any number of things on your system, from web services, to print services, and so forth. You've no doubt seen the services console before in XP or Windows 2000 because it has been around a long time.
The services structure hasn't changed much in Vista. You might notice a few more services in Vista. You now have the option to turn off some services to reserve system resources. But from within Service, you can do the following:
- Stop, start, pause, resume, or disable a service. You can also see the description of what each service does and which other services rely on it to work.
- Configure recovery actions in the event of a service failure (like restarting the service).
- Configure a service to run under the security context of a user account that is different from the logged-on user or the computer account.
- Configure hardware profiles that use different services enabled or disabled.
- Export your services information to a .txt or .csv file.
- Monitor the status of each service.
You can use the sc.exe command to communicate and configure the Service Control Manager and services. You can also use the net start or net stop command to stop and start services, but SC is much more powerful.
An example of the sc.exe command is the following:
sc config <service name> start=<mode>
You can start with the following modes:
- auto—A service automatically started at boot, regardless of a user logging on or not
- boot—A device driver loaded by the boot loader
- demand—The default, a service that is manually started
- disabled—A service that is prevented from starting
- system—Started during kernel initialization
For more information on SC, type sc.exe /? from a command prompt.