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 


June 2005

Script Your Own Desktop Diagnostic Tool

Build a tool to troubleshoot PC problems and learn about command shell scripting, too
RSS
Subscribe to Windows IT Pro | See More Resource Kit Articles Here | Reprints
Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

What if you could offer your Help desk technicians one-stop shopping in computer configuration information that included group memberships, installed software, hot fixes, disk space, uptime information, and blue screen instances? If you collected such data before dispatching a technician, you'd give the tech a detailed picture that could help him or her find hidden problems more quickly. In many cases, problems could be identified and resolved without an onsite tech visit. Another benefit would be that you could identify potential problems and resolve them before they become headaches. No single tool that I know of will produce a report with all the details of user permissions and PC configuration, but the good news is that you can build your own reporting tool by using command shell scripting utilities. If you're new to scripting, the DesktopDiag.bat script that I've developed will introduce you to the world of command shell scripting. As a bonus, the script can do double duty on servers. Having a detailed list of installed server software, services, and various configuration options can be an asset in server configuration control, disaster recovery planning, and server virtualization migrations.

Why Build Your Own Configuration Reporting Solution?
In many IT departments, the push is toward using Commercial Off-the-Shelf (COTS) tools and away from developing custom solutions. However, the main disadvantages of using a custom solution—development costs, maintenance costs, and breakage risk—don't apply to a scripted solution such as DesktopDiag.bat because such tools are simple to create, easy to maintain, and run only in an acquisition mode without making any configuration changes. In addition, your environment might require unique information that wouldn't be of interest to other companies with dissimilar environments. Having your own tool gives you the flexibility to add and remove items from the report. And, if you discover a new resource kit or third-party utility that has useful output for your report, you can easily incorporate it in the tool. Another advantage to a home-grown tool is cost. Because most scripting utilities are freeware, the cost of putting your own scripted solution together is minimal. Finally, if you decide to go shopping for a COTS solution in the future, you'll have developed an accurate requirements list.

Compiling the Output Wish List
When I developed DesktopDiag.bat, I first listed the information I wanted to capture. The list divides naturally into the categories of user and computer settings.

User settings (for logged on user or a specified user account)

Logged on username(s)
Username data such as user domain, friendly user name, user ID
User details such as home drive, home path, logon script, account expiration, logon hours, password age, password last reset
Level of authority the logged on user has
Local groups the logged on user is a member of
User profiles on the PC
User local and global group memberships

Computer settings

OS and service pack level
List of installed hotfixes
Network setting, including IP address information and MAC address
List of automatically starting programs
Processor type, speed, and installed memory
Resultant Set of Policies (RSoP)
OU location
List of Installed programs
Services and their status
List of shared folders
Details on logical drives, including drive letter, space-free and space-used statistics
Physical drives details
Video card details
Installed printers
Local computer group memberships
Bluescreen and uptime information
Local Administrator group members
Local groups the computer is a member of

Identifying Tools to Obtain the Data
Choosing utilities that will extract the data you want to see is a simple matter of listing the information you want, then locating the utilities that deliver that output. In many situations, a utility can give you more information than you require. You can either filter the output to just what you need or dump and sort through all the information that a particular tool supplies. The disadvantage to relying on a lot of filtering is that doing so adds overhead and increases script runtime. In some cases, you'll need to chain commands together; for example, you'll pull an initial piece of information such as the logged on username, then use that information to get group memberships. DesktopDiag.bat minimizes filtering. You'll likely see runtimes of well under 1 minute if the script is run locally, or from 1 to 1.5 minutes if run remotely. It would take much longer to retrieve the same information by running the tools individually or by using the Windows GUI.

DesktopDiag.bat uses 14 utilities and many built-in commands to capture report information. Table 1 lists these utilities. I've also developed a utility matrix that offers more detail about the tools and commands that DesktopDiag.bat depends on. To download the matrix and DesktopDiag.bat, magazine subscribers and registered Web site users can go to http://www.windowsitpro.com, enter 46268 in the InstantDoc ID text box, then click the 46268.zip hotlink. Because it's unusual for the resource kit and third-party tools to be installed on a local machine, I recommend that you create a shared folder to house the utilities on a server. Your script can point to this location. Keep in mind that limitations exist on what a given utility can accomplish. Some of the best tools for capturing information, such as the Ipconfig command, don't work remotely unless you use a remote command tool such as Sysinternals' PsExec or Beyond Logic's BeyondExec to launch them.

Identifying Capture Scenarios
In any solution you create, certain capture scenarios and tool limitations will affect what you can accomplish. In a PC configuration report, for example, if you plan for the report to show user information, what will happen if the user isn't logged on when you are querying his or her machine remotely? I identified four capture scenarios for DesktopDiag.bat that are representative of most troubleshooting situations.

  1. Capture data on a local machine while a user or administrator is logged on locally.
  2. Capture data on a remote machine while a user is logged on locally.
  3. Capture data on a remote machine and allow the forcing of a specified user account.
  4. Capture data on a remote machine while multiple users are logged on locally, both by local logon and Windows 2000 Server Terminal Services.
   Previous  [1]  2  Next 


Reader Comments
D

middledd April 28, 2008 (Article Rating: )


You must log on before posting a comment.

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




Learning Path To learn more about command shell scripting, check out:
"“Rem: Learning about Windows Shell Scripting"

"“Shell Scripting 101 Lessons 1 through 10"


To learn more about specific shell scripting tools, take a look at:
"“7 Cool Command-Shell Scripting Tools"

"“Command-Line Scripting Tools in Windows 2003"

"“Command-Shell Tool Resources"

"“Creating a Shell Scripting Tools Menu System"


Access a great resource for command shell–troubleshooting script code:
"Jerold Schulman’s JSI FAQ Web site"


Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of July 21, 2008

An often irreverent look at some of the week's other news, including an iPhone 3G defeat, 180 million copies of Windows Vista in the wild, Microsoft earnings some more Yahoo silliness, Wii vs. Xbox 360, EU vs. Intel, AMD ousts its CEO, and so much more ...

The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...

The iPhone as a Mail Device

An Exchange administrator and self-proclaimed "Windows Mobile device wrangler" gives you the scoop on how well the iPhone 3G works for enterprise email, and points out some surprising omissions in Apple's latest release. ...


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!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting 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.


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Shortcut Guide to SQL Server Infrastructure Optimization
With right tools and techniques, you can have a top-performing SQL Server infrastructure without having to cram your data centers so that they're overflowing. Download this eBook to learn how.

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).

Become a fan of Windows IT Pro on Facebook!
Join us on Facebook and be a fan of Windows IT Pro!

Continuous Data Protection and Recovery for Exchange
Read this white paper to learn about Continuous Data Protection (CDP), Exchange 2007's local continuous replication and cluster continuous replication features.

Rev Up Your IT Know-How with Our Recharged Magazine!
The improved Windows IT Pro provides trusted IT content with an enhanced new look and functionality! Get comprehensive coverage of industry topics, expert advice, and real-world solutions—PLUS access to over 10,000 articles online. Order today!

Tips to Managing Messaging
Discover three fundamental mail and messaging management services - security, availability and control services - and how you can implement them in a Microsoft-centric mail and messaging environment.

Get It All with Windows IT Pro VIP
Stock your IT toolbox with every solution ever printed in Windows IT Pro and SQL Server Magazine plus bonus Web-exclusive content on hot topics. Subscribe to receive the VIP CD and a subscription to your choice of Windows IT Pro or SQL Server Magazine!



Drag & Drop Data Mapping Tool
Try this award-winning data mapping, & transformation tool that supports multiple databases, flat files, Web services, EDI, Excel 2007, & more! Free trial for 30 days!

Overcome bloated Windows file systems
Crossroads FMA delivers powerful yet inexpensive data migration

Bandwidth Monitoring Tool from SolarWinds
Identify largest bandwidth users in seconds. Get the free download now.

Speed Deployment of Vista and Microsoft Office
Read this white paper to learn how you can maximize your Vista and Office investments while lowering costs and increasing efficiency.

Integrated Virtualization Done Right
Download this white paper on server virtualization to begin improving resource utilization and lowering operating costs.

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.

KVM over IP Solutions
Learn about a KVM over IP solution that is specifically designed to meet the needs of the distributed IT environment.
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
IT Library Technical Resources Directory Connected Home Windows Excavator 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