Windows Tip: Forcing a remote reboot

April 16, 2007, 11:46 AM —  ITworld.com — 

Send your Windows question to Mitch today! | See other Windows tips



You've probably heard that old saying, "When in doubt, reboot." There can be many reasons why you might need to reboot a system from applications that leak memory to problems caused by patching. And while rebooting a system to fix an issue isn't an elegant solution, well if it works, it works. Right?


Unfortunately, sometimes when you try and reboot a remote system it may not behave as expected. For example, one business I know has scheduled reboots for one of their servers using Task Scheduler and the shutdown /r, but from time to time the reboot fails for no apparent reason, even when using the /f (force) command. How can you make sure your server reboots when you tell it to?


One thing you can try is to write a script that shuts down problematic applications and services running on the server in an orderly fashion. This approach can be helpful with servers running Microsoft Exchange for example, since some Exchange services have large amounts of data cached and may take a considerable time to shut down properly. The Script Repository on Microsoft TechNet has a sample script you can customize to shut down services on a system. Then, once you've run your script and shut down all problematical services and applications, you can try running the shutdown /r command to restart the system.


But what if you need to reboot a remote system immediately, but you've had issues using shutdown /r in the past? In this case, you can try using the following script to reboot your system:


strComputer = "<name or IP address of the remote system>"
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}\\" & strComputer & "\root\cimv2").ExecQuery("select * from Win32_OperatingSystem where 
Primary=true") For Each OpSys in OpSysSet OpSys.Reboot() Next

This script works by invoking the Reboot method of the Win32_OperatingSystem class on the targeted computer, and it requires that you have the Shutdown privilege on the remote computer. I've been told (by those in the know concerning product support) that this method can be a "more forceful" method of restarting a system than the simple shutdown /r command.

 

ITworld.com

I like it!
Post a comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Resources
White Paper

Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.

Webcast

Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.

White Paper

Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.

Free stuff

Enterprise 2.0 Implementation
By Aaron C. Newman, Jeremy Thomas
Published by McGraw-Hill
Learn more!

Deploying Cisco Wide Area Application Services
By Zach Seils, Joel Christner
Published by Cisco Press
Learn more!

Featured Sponsor

AISO founders envisioned a Web hosting company that was environmentally friendly. While the company employed energy-efficient innovations like solar panels, its infrastructure produced unacceptable power and cooling requirements. Find out how AISO leveraged AMD technology to overcome their challenge in this case study white paper.

In this whitepaper, Scalar explores the opportunity to change the landscape with respect to mission critical databases built around Oracle. Leveraging technologies such as Linux, high-end commodity processing power and Oracle RAC technology to architect, design, build and maintain database infrastructure that delivers maximum availability, reliability and performance at a fraction of traditional cost.

On a typical day, weather.com, the Web site for The Weather Channel in Atlanta, serves up between 15 million and 20 million page views. But in September 2004, when back-to-back hurricanes ransacked Florida, the peak traffic on one day more than tripled: over 70 million page views by more than 7 million unique visitors. Read the full success story now.

More Resources