Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


January 2008

Castaway on Command-Prompt Island

A Windows admin finds a lifesaver in the SC command-line tool to help him get a crucial server back online
RSS
Subscribe to Windows IT Pro | See More Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Executive Summary:
Many Windows system administrators and network administrators rely on the Windows administrative GUI to manage their servers. However, when one administrator applied patches to the servers in his company’s data center, a problem arose that prevented him from accessing the GUI. The administrator found the SC command-line tool (Sc.exe), which let him remotely access the server and troubleshoot the problem to get his systems back online with all services restored.


As a computer consultant, I often encounter system administrators who find themselves in trouble if they can’t perform an action through the GUI. With many good command-line tools available, and resources such as Windows IT Pro to learn about them, admins should have a variety of methods in their toolbox to solve problems.

Here, for instance, is the story of a Windows administrator—we’ll call him Frank. He relied mostly on the Windows GUI administrative tools to perform systems management tasks. However, one day when Frank couldn’t access a crucial server in his company’s data center, he had to find a command-line alternative to solve the problem. Here’s what happened.

RPC Server Lost at Sea
On a certain Patch Tuesday, Frank had servers to patch at a data center. It was easier for him to apply the patches from a remote connection, so at around 9 p.m. he logged on to the system and patched all the servers, including the domain controller (DC) with the Global Catalog (GC) role.

After he rebooted everything, the servers all responded to a Ping. But when he tried to check his email, Microsoft Office Outlook couldn’t find the Exchange server. Then he tried logging on to the DC but received an error message: The system cannot log you on due to the following error: The RPC server is unavailable. The good ship GUI was heaving and swaying in the waves, with no access to the GC role. Without this role running on an Active Directory DC, Exchange can’t run.

Frank was desperate to find out what was going on with the server, and he remembered that he could use a Microsoft Management Console (MMC) snap-in to read the logs of another server. So he logged on to a member server to try running the snap-in but still couldn’t reach the DC. Frank had run aground on an uncharted island, unable to reach the “mainland” of the DC, and he couldn’t get any information from the system to help solve the problem.

As he paced around, trying to think of a way out of this situation, he tripped over a laptop bag that appeared as if washed up on the sand. Looking inside, he found an issue of Windows IT Pro. With no better ideas, he started paging through the magazine.

SC Tool to the Rescue
Suddenly, he saw an article about a command-prompt tool he hadn’t been aware of: SC (sc.exe), a tool that could be used to manage services running on a local or remote machine. The article was “The All- Purpose Service Controller,” November 2006, InstantDoc ID 93400. As Frank read the article, he thought, “This tool could help me out of my predicament.”

He logged on to the member server again and entered the SC command in the command window to learn its syntax, which came back as

sc <server> [command] [service name] <option1> <option2>...

Frank soon realized this wasn’t a one-use tool, but a Swiss Army knife that would return him to the GUI and restore email service. He knew the server wouldn’t respond by machine name, but it had responded to a Ping. So he entered this command:

sc \\192.168.10.10 query

In an instant, all the server’s services and their information scrolled down his screen. He needed to narrow down the query to a specific service. According to the connection error message, the remote procedure call (RPC) service wasn’t available, so Frank entered the following command to see what was going on with RPC:

sc \\192.168.10.10 query RPC

The command returned an error message: [SC] EnumQueryServices Status:OpenService FAILED 1060: The specified service does not exist as an installed service.

From this error message, Frank deduced that the SC command didn’t recognize the RPC service’s display name (i.e., RPC), so he retried the command using RPC’s service name, rpcss. This time, the command results showed him that the RPC service was running, although the logon error had said the service was unavailable. Now Frank was really confused. Looking further at the query results, Frank noticed the State parameter. A State value of 4 means the service is running.

Homing in on the Problem
He ran the query command again without specifying a service and looked at the states of all running services. Eventually he noticed that the Netlogon service was paused. Perhaps this was the one thing keeping him out of the server.

He didn’t have access to services.msc to start or stop the Netlogon service, but he had the SC tool. So Frank entered the following command to stop the Netlogon service:

sc \\192.168.10.10 stop netlogon

Then he queried to see the results of the previous command by entering

sc \\192.168.10.10 query netlogon

which showed him that the State value for Netlogon was now 2, meaning the service wasn’t running. He then ran the following command to start Netlogon:

sc \\192.168.10.10 start netlogon

To see this command’s results, he again queried Netlogon and saw that the service was running. Eureka! He had restarted the service from across the network by using the SC command-prompt tool.

Frank was now able to log on to the DC; all the GC server services were running and email was working. He had escaped from Command- Prompt Island and was back aboard the good ship GUI. It just goes to show you: Having the right tool is like wearing a life jacket when sailing in calm seas—you might not need it, but you’ll be prepared should a sudden, unexpected squall hit.

End of Article



Reader Comments
A good, straight forward example of a far too common scenario. One of Windows' greatest benefits is that so many tools are easily accessible due to the great UI. One of its greatest problems is that this has allowed many of us get lazy. Every Windows admin should be VERY familiar with the CLI alternatives to the rich GUI-based admin tools. SC is just one of them.

netmarcos,netmarcos January 03, 2008 (Article Rating: )


I love the titles to your articles, Curt! You make reading what could be a boring subject a lot of fun. As Mark mentions above, we all need to take a step back from time to time and remember that there is more than one way to skin a cat. Great article, Curt. Keep ‘em coming. Eric

ebrux January 03, 2008 (Article Rating: )


Excellent article. It proves a few things we all should already know:

- The learning process in our chosen field is forever ongoing

- Help can come from unexpected places.

- Don't panic

- Always be as prepared as possible.

Speaking of learning more and being prepared, I think I'll respond to this renewal letter I just got from Windows IT Pro.

JamesNT

JamesNT January 04, 2008 (Article Rating: )


Excellent article! This should be required reading, as a reminder, for all Administrators.

jsclmedave January 04, 2008 (Article Rating: )


Curt, great article. Just proves that the command line isn't as scary as everyone seems to think and is usually the only way to get out of problem. Thanks for reminding me on a command line tool I hadn't used in a while.

DennisOl January 04, 2008 (Article Rating: )


Thanks all for the kudos on Curt's article! We have some other articles from Curt in the pipeline, so stay tuned. And if you have other ideas for "annoyance" articles, please drop me an email and tell me your ideas.

Anne Grubb, Web site strategic editor, Windows IT Pro (agrubb@windowsitpro.com)

AnneG_editor January 07, 2008 (Article Rating: )


Great article: answers the age-old question, "When am I going to use this in real-life?" Keep up the good work!

walker24 January 07, 2008 (Article Rating: )


Good article. The CLI tools have been overlooked by 'lazy' admins for ages. This article shows how it can save a lot of work and time if you have a basic understanding of the tools. And an open mind to look further than the GUI.

rhwsanders247 January 14, 2008 (Article Rating: )


Hi,
Finally got round to reading this today and found it a great lesson!
It is always good to have multiple ways of attacking a problem, and Curt described this scenario really well and with some good humour!

Thanks
Nathan

NathanWinters January 31, 2008 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

Escape From Yesterworld

Kevin points you to the funniest SQL Server website ever! ...

The Desktop tab is missing from the Display Properties in Windows XP?

...


Related Articles Unleashing SC on Service Configuration

Taking 3 Swings at SC

The All-Purpose Service Controller

Crouching Server, Hidden Memory Leak

Windows OSs Whitepapers Replay for Exchange: Enterprise Protection and an Affordable Price

Are You Satisfied?

A Preliminary Look at Deployment Plans for Microsoft Windows Vista

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

WinConnections Conference Fall 2008
Don’t miss the premier event for Microsoft IT Professionals in Las Vegas, November 10-13. Register and book your room by August 25 and receive a FREE room night (based on a three night minimum stay).

Maximize your SharePoint Investment – 8 Cities
Discover best practices and tips for both architecting and administering SharePoint. Early Bird Price of $99 through Sept 15th.

Find a new job now on the all new IT Job Hound!
Search jobs, post your resume, and set up job e-mail alerts!

Master SharePoint with 3 eLearning Seminars
Learn how to build a better SharePoint infrastructure and enable powerful collaboration with MVPs Dan Holme and Michael Noel. Register today!

Top Tools for Virtualization Disaster Recovery & Replication
View this web seminar on August 14th to learn about two tools that will result in faster backup and restore with P2V disaster recovery.

SharePointConnections Conference Fall 2008
Don’t miss the premier event for Microsoft IT Professionals in Las Vegas, November 10-13. Register and book your room by August 25 and receive a FREE room night (based on a three night minimum stay).

VMworld 2008 - Sign Up Today!
Join your peers on September 15-18 at The Venetian Hotel in Las Vegas as VMware hosts VMworld 2008, the leading Virtualization event.



When managing just VMware isn’t enough
Plan/Manage/Secure – NetIQ VMware management. Download whitepaper.

What’s up with your network? Find out with ipMonitor
Availability monitoring for servers, applications and networks – FREE trial

Microsoft® Tech•Ed EMEA 2008 IT Professionals
Advance your thinking with new ideas and practical real-world solutions at Microsoft’s FIVE day technical infrastructure conference 3-7 Nov., 2008. Register before 26 September 2008 to save €300.

Order Your Fundamentals CD Today!
Gain an introduction to Exchange, learn server security requirements, and understand how unified communications can play a role in your messaging strategies with this free Exchange CD.

Are You Really Compliant with Software Regulations?
View this web seminar that will help you with compliance best practices and check out a management solution to assure that you won’t be in jeopardy of an audit.

Virtualization Congress Oct. 14-16 in London
Don't miss Virtualization Congress, the premiere EMEA conference dedicated to hardware, OS and application virtualization. Oct. 14-16 in London.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technical Resources Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing