Microsoft

Working with the Windows NT UPS Service

A UPS is essentially a battery capable of providing power to your computer on demand during a power failure. In this Daily Drill Down, Brien Posey explains how to configure the UPS service so that Windows NT can interact with the UPS.


Has a power failure ever caused you to lose everything you were working on? If you’ve been working with computers for any length of time, you’ve probably had this experience more than once. Perhaps after the first power failure, you got smart and connected a UPS to your system. But did you get the correct UPS? Have you tested it?

There’s nothing more frustrating than having a PC (or a server) that’s connected to a UPS go down with every other computer in the building when the power goes out. In this Daily Drill Down, I’ll discuss some things to look for in a UPS. I’ll also describe how to configure the UPS service within Windows NT to interact with the UPS should a power failure occur while you’re away from the office. Finally, I’ll explain the importance of testing your UPS and some methods for doing so.

What is a UPS?
Just in case you’re not familiar with the term, UPS stands for uninterruptible power supply. It’s essentially a battery that’s capable of providing power to your computer on demand during a power failure. The reasons for using a UPS are obvious. Because a UPS keeps your computer from going down during a power outage, it prevents data loss. A UPS may also protect your computer from damage associated with the sudden drops or boosts in power that are normally associated with a power failure. These power fluctuations can cause chips in your computer to malfunction or burn out completely.

Things to look for in a UPS
When it comes to selecting a UPS, there are several things to look for. First, you must decide what type of UPS you want. There are two basic types:
  • Online
  • Standby

Online UPSs are designed to constantly provide your computer with power. They are connected directly between the wall socket and the computer’s power cord. The power they draw from the wall keeps the UPS's batteries charged. This type of UPS also provides very good power conditioning. It contains circuitry designed to protect the computer from voltage spikes and drops. As I mentioned, such spikes and drops can physically damage your computer.

Standby UPSs, on the other hand, are designed to provide either normal AC power or battery power. Like the online UPS, a standby UPS still connects to the wall socket and the computer plugs directly into the UPS. This type of UPS provides normal AC power until a power failure occurs. When a power failure does occur, or the voltage drops below an acceptable level, the UPS detects the failure and switches to battery in a fraction of a second. Some standby UPSs are also able to provide power conditioning. However, you shouldn’t necessarily rely on them as your primary source of surge suppression.

Both types of UPSs will get the job done. One type isn’t necessarily any better than the other. They merely use different methods of getting the same job done. When selecting a UPS, you should take more important factors into account. You should always limit your search to those UPSs that appear on the Windows NT hardware compatibility list. Once you have a few to choose among, you should ask yourself these questions:
  • Will you use this UPS for a single computer or for multiple computers?
  • How big does the UPS need to be to service the computer or computers?
  • How long does the computer need to remain running before the automatic shutdown sequence begins?
  • Do you want the UPS to provide power conditioning?
  • Do you want to monitor the UPS status via SNMP through management software, the event log, or other interface?

Of these questions, the first two are the most important. I’ve seen computers that are plugged into a UPS fail right along with computers that aren’t when a power failure occurs, simply because the UPS is overloaded. Worse yet, a UPS that’s extremely overloaded may cut power to the computer (or computers) even when the normal AC power is still on. You can be working peacefully and then hear the power failure alarm and have the computer’s power fail—all while the main power is still on.

Therefore, because you don’t want to lose all your data and you really don’t want the embarrassment of the power failure alarm drawing all of your coworkers’ attention to the fact that you just lost everything while the power was still on, it’s important to know how much is too much of a load. It’s impossible for me to give you hard numbers, because every computer is different.

How big a UPS do I need?
The main facts to keep in mind are that each UPS has a power rating. For example, a UPS with a rating of 300 will keep a small computer running for about two to five minutes. UPSs with higher power ratings can support larger computers or keep small computers running for longer periods of time.

You may be wondering what I mean by a large or small computer. When referring to a large or small computer, I’m referring to power consumption. Larger monitors consume much more power than smaller monitors. For example, don’t even try to run a computer and a 19-inch monitor off a UPS that’s rated at 300. It won’t work very well. RAID arrays also consume large amounts of power. This is especially true of external RAID cabinets. If your computer uses a RAID array, a large monitor, or both, make sure you use a large enough UPS to meet your needs. You should also never plug other peripherals into your UPS. Some peripherals, such as laser printers and flatbed scanners, tend to draw way too much power. You can damage the UPS, the device, or both by plugging such devices into a UPS. Smaller peripherals such as external modems and ZIP drives are usually okay to use with a UPS.

It stands to reason that if larger computers require larger UPSs, then you need a really big UPS if you’re planning on supporting multiple computers. This statement is very true. Some people (myself included) are guilty of plugging a whole lot of computers into a single wall outlet. However, you can’t do this with most UPSs, because a UPS doesn’t provide nearly as much current as a normal wall socket. You should limit the number of devices plugged into a UPS to the number of electrical outlets on the back of the UPS.

As for the other questions—how long you need the computer to remain running after a power failure, and whether you want to be able to view the UPS’s status through the computer—you’ll have to read the package the UPS comes in, or the description in the catalog. Needless to say, all UPSs aren’t created equally.

Configuring the UPS service
Now that I’ve discussed things to look for in a UPS, it’s time to discuss the Windows NT UPS service. Without the UPS service, a UPS simply delays the inevitable. A UPS can provide power to a PC for only a few minutes. After the battery runs out, the computer will fail, resulting in data loss just as if you didn’t even have a UPS. The idea behind a UPS isn’t to keep the computer running indefinitely. Instead, a UPS is designed to get you through power outages that last for only a few seconds, and to give you ample time to shut down the system before the battery goes dead.

Normally, this isn’t a problem. If the lights have gone out and the battery alarm on the UPS is wailing, most users realize that the power is out and that the computers need to be shut down. But what if the power goes out in the middle of the night or when you’re on vacation? Believe me, there’s nothing worse than getting a phone call at night or on vacation because data was corrupted during a power failure.

That’s where the UPS service comes in. The UPS service is designed to provide the UPS with a way to interact with Windows NT. When a power failure occurs, the UPS is able to let Windows NT know by sending a signal through the serial port. Windows NT can then respond by using the parameters you’ve specified.

You can access the configuration options for the UPS service by double-clicking on the UPS icon in Control Panel. When you do, you’ll see a dialog box similar to the one shown in Figure A.

Figure A
The UPS Service provides a mechanism for the UPS to interact directly with Windows NT.


As you can see, the first thing you must do is tell Windows NT that a UPS is connected to the computer. You can do so by selecting the Uninterruptible Power Supply Is Installed On check box and choosing the correct serial port from the drop-down list.

You probably noticed that Power Failure Signal, Low Battery Signal At Least 2 Minutes Before Shutdown, and Remote UPS Shutdown all have a positive and negative radio button beside them. The positive and negative buttons indicate what interface voltage represents the condition. For example, if the normal UPS signal is positive, it will switch to negative when a power failure occurs. The directions that come with your UPS will indicate which polarity your UPS uses.

The next field on the UPS dialog box allows you to execute a command file. You can specify any file that has the .exe, .com, .bat, or .cmd extension, as long as the file is located in the %systemroot%\system32 folder. This command file might be designed to do things like close open files or shut down databases before the Windows NT shutdown occurs. Note that if the command hasn’t completed in 30 seconds, Windows NT will terminate the command and continue with the shutdown process.

I mentioned the low battery signal earlier. The low battery signal usually indicates that only two minutes of power remain before the UPS goes dead. However, not all UPSs have a low battery signal. For these UPSs, you can use Windows NT to calculate how much charge remains.

To do so, you must enter an expected battery life in the space provided. This is the amount of total battery time the UPS is supposed to be able to have. It’s a good idea to lowball this number since you don’t want to lose power because of a miscalculation. For example, if the UPS is rated at 20 minutes, you might specify 17 minutes instead.

Also in the UPS Characteristics section, you’ll see the Battery Recharge Time Per Minute Of Run Time setting. By default, Windows NT assumes that the UPS has no charge when it’s first plugged up. Windows NT also assumes that for every hundred minutes the UPS has been plugged in, it will build enough of a charge to support one minute of battery time. You can change this rate if your UPS specifies a different recharge rate. The other two settings relate to when the initial power failure warning will be sent and how often subsequent messages will be displayed.

These messages are normally sent via the Messenger service. Therefore, it’s a good idea to run the Alerter service and the Messenger service in conjunction with the UPS service. The Messenger service sends messages to the local computer and to other network users who use Windows NT.

The Alerter service can send alerts to specified network users. You should set these services and the UPS service to launch at startup. To do so, double-click the Services icon in Control Panel. Next, select the service that you want to control and click the Startup button. When you do, you’ll see the service’s dialog box. Select the Automatic radio button and click OK. Click OK again to close the Services dialog box when you’ve finished.

Testing the UPS
On some systems, strange things can happen when you start the UPS service. If you accidentally set the polarity wrong, some UPSs will shut down as soon as the UPS service is started. Therefore, it’s necessary to thoroughly test the UPS before a power failure does occur.

To test the UPS, you must have a good backup just prior to the test. Also, be sure the UPS is fully charged. This may require leaving the UPS plugged in with no load for a day or more. After the UPS charges, if you’re testing a server, be sure all users are disconnected.

Next, start the UPS service and verify that everything continues to run correctly. Disconnect the UPS’s power cable from the wall to simulate a power failure. The computer should remain powered on. If the computer powers off or immediately reboots, the UPS may be too small or not completely charged.

The UPS should then begin sending warning messages, if you’ve configured it to do so. Finally, the UPS service should run any scripts you’ve specified and shut down the computer. If the shutdown doesn’t complete before the battery runs out, you may need to adjust the UPS service’s Expected Battery Life parameter.

Conclusion
In this Daily Drill Down, I’ve discussed reasons why it’s important to have Windows NT connected to a UPS. I explained how to configure the UPS service so that Windows NT can actively interact with the UPS during power failures. I also discussed why you should test your UPS and some methods of doing so.

Brien M. Posey is an MCSE who works as a freelance technical writer and as a network engineer for the Department of Defense. If you’d like to contact Brien, send him an e-mail. (Because of the large volume of e-mail he receives, it's impossible for him to respond to every message. However, he does read them all.)

The authors and editors have taken care in preparation of the content contained herein, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

Editor's Picks

Free Newsletters, In your Inbox