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 


November 2002

Command-Shell Scripting Lives On

Microsoft can't leave this highly effective technology behind
RSS
Subscribe to Windows IT Pro | See More VBScript Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Command-shell scripting is one of those technologies that Microsoft has tried hard to leave behind in the bin of legacy software. Unsexy but highly effective, command-shell scripting is a DOS-era holdover that's too useful to ever dispose of. The command-shell syntax is easy to learn, and because the syntax is built into every Microsoft OS, command-shell scripts are easy to deploy. In addition, command-line tools that command-shell scripts use regularly are equally easy to install. They typically require simple xcopy-style deployment to the target system with no need to perform any additional installation or registration step. This combination of factors provides a quick turnaround for administrators who need to quickly and effectively create scripts to automate regular administrative tasks.

However, command-shell scripts—with their limited text-oriented input and output capabilities—never fit into Microsoft's picture of Windows automated administration. For several valid reasons, Microsoft has clearly designated VBScript as the replacement for command-shell scripts. Microsoft first pushed VBScript (and later its driving shell, Windows Script Host—WSH) and a plethora of COM objects as the scripting tool of choice. To be sure, VBScript is a more powerful alternative to simple command-shell scripts. The language advantages are numerous, including the fact that VBScript is integrated with the Windows UI whereas command-shell scripting is text-oriented. However, script writing involves more than the capabilities of the language—and scripting with VBScript and WSH has one big disadvantage: By itself, VBScript provides precious little functionality.

The VBScript Learning Curve
To access system and network resources, VBScript typically requires a variety of COM objects. This dependency on external COM libraries has prevented VBScript and WSH from supplanting command-shell scripts. The VBScript syntax is easy to learn and well within the capabilities of end users and network administrators to master and use. Unfortunately, that statement isn't true of the myriad COM objects that you must find and understand if you want to do anything useful with VBScript.

For example, if you want to add user accounts, VBScript alone can't manage it. Adding the Active Directory Service Interfaces (ADSI) COM object enables this capability. However, to use the ADSI COM object, you must understand the ADSI object's properties and methods. And that's nothing compared with the daunting complexity of Windows Management Instrumentation (WMI), which you need to access all the really important system settings. The WMI object with its powerful (albeit convoluted) namespace lets you display and change process, CPU, disk, and performance information. But you first need to know which COM object you need for each task, which can be a tough assignment in its own right.

Such complexities reveal Microsoft's deeply ingrained developer orientation. Microsoft assumes that all users and administrators are programmers. But that's not the case—which is why VBScript and WSH won't replace command-shell scripting anytime soon. Finding and mastering the complexities of dozens of COM objects presents too steep a learning curve—one that you must repeat for each new task that requires an additional COM object. Many administrators find that the time required to pick up and use VBScript and WSH to perform useful administrative tasks is just too great—a hurdle command-shell scripts don't present. Just for the record, VBScript and WSH are typically my first choice for generating scripts, but many times I still find command-shell scripts quicker to write and easier to implement.

Command-Shell Scripting's Demise Exaggerated
Even Microsoft begrudgingly has acknowledged the continuing popularity of command-shell scripting by adding 30 additional command-line functions to the upcoming version of Windows .NET Server (Win.NET Server) 2003. So—despite command-shell scripting often being regarded as a step-child to VBScript and WSH—command-shell scripting won't go away anytime soon and will be supported fully in the foreseeable future releases of Windows.

End of Article



Reader Comments

You must log on before posting a comment.

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




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

New Microsoft/Yahoo! Deal? No

On Sunday, the Times of London reported that Microsoft had renewed talks with failing Internet giant Yahoo! and would manage its search engine for 10 years, while Yahoo! would retain control of its email, messaging, and content services. This report ...

How can I stop and start services from the command line?

...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Introduction to Identity Lifecycle Manager "2"

Top 11 Reasons Why Oracle Database 11g on Windows is Right For You

Power Up! With Virtualization Online Conference

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.


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 Technology Resource 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