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 


May 2008

Vista Command-Line Tools

Use these tools to mirror directories, manage ACLs, perform backups, and complete other important administrative functions
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:
Microsoft's Windows Vista operating system (OS) includes a host of command-line tools to help you administer your systems. Here are the commands you need to modify your boot configuration, manage access control lists (ACLs), perform backups and system assessments, and other useful functions.

The lion’s share of the attention to Windows Vista always seems to center around the new interface, which is understandable considering its exciting new look and feel. Unfortunately, part of the attention is because you now have to find new ways of doing old tasks. However, new features in Vista don’t end with the UI. Under the covers, Vista also sports command-line tools—many of them new—that make a powerful addition to your administrative toolbox. Here are my favorites.

10. Bcdedit—The days of editing the simple boot.ini file are gone. Vista’s new boot process saves its system boot configuration in the Boot Configuration Data (BCD) store. Like all bad ideas, the BCD store replaces a simple concept with a complex albeit more secure one. Bcdedit is your primary tool for editing the BCD store. Bcdedit supports a wide set of command-line options. For instance, to list the contents of the store you can run

bcdedit /enum

9. Choice—A handy batch-file command, choice lets you display a list of choices to users of a command-shell script. The choice command returns an index value in the ERRORLEVEL environment variable indicating the user’s selection. For example, the following command prompts users to enter Y, N, or C; the ERRORLEVEL variable returns 1, 2, or 3 respectively:

CHOICE /C YNC /M “Press Y, N, or C.”

8. Waitfor—The waitfor command is a useful scripting command that synchronizes processes running on multiple systems on the network. As its name suggests, waitfor can pause a script until the command processor receives a specified signal, and it can also send a signal to one or more systems on the network. The following command waits for the ScriptDone signal:

waitfor ScriptDone

7. Wbadmin—Although you might not have a clue based on its name, the new wbadmin command is Vista’s command-line backup tool. The following example shows how to use wbadmin to backup the C and D drives to the share named backup on myserver:

wbadmin start backup -backupTarget:\\myserver  backup include:c:,d:

6. Icacls—The Icacls command replaces the older cacls command. Icacls lets you list, update, and back up the access control lists (ACLs) for files and directories. The following example shows how you can save the ACLs for the C:\temp directory:

icacls c:\temp /save tempacl

5. Winsat—Winsat is the new Windows System Assessment tool. It runs automatically when you install Vista, but you can run it on demand for simple system benchmarking and system information. For instance, to list your system information, you could run winsat with the features parameter:

winsat features

4. Clip—The new clip command is a handy tool that copies the output of other command-line tools to the clipboard. The following example shows how to use clip to copy the contents of the file mytext.txt to the clipboard:

clip < mytext.txt.

3. Forfiles—The forfiles command is another useful batch-file tool. It executes a command over a set of files. Forfiles is much easier to use than the older and more obtuse for command. The following example shows how you could list all files more than 30 days old in the c:\temp directory:

forfiles /p c:\temp /s /d -30 /c “cmd /c echo @file

2. WinRS—The WinRS tool is essentially the Windows version of Linux’s Secure Shell (SSH). WinRS lets you open a secure command window to a remote host. All the contents of the remote shell are encrypted. The following example connects to the server named myserver and runs the dir command:

winrs -r:myserver dir

1. Robocopy—Without a doubt, the best commandline addition to Vista is robocopy. Although robocopy isn’t new to most of our readers (it’s been a staple in the Windows Resource Kit for years), Vista is the first release that includes robocopy as a part of the OS. Robocopy is a super-powerful command-line copy tool. The following example shows how to create a mirrored copy of the directory called shares and all of its subfolders.

robocopy “C:\Shares” “\\server2\ Shares Backup” /MIR /R:2 /NP

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
Windows Chief Leaving Microsoft

Kevin Johnson, the man most directly responsible for current and future versions of Windows, as well as Windows Live and Microsoft's online services, is leaving the company for a position at Juniper Networks. Johnson has been co-president or president ...

How can I limit Exchange mailbox size?

...

The Memory-Optimization Hoax

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


Related Articles Q. How can I view the OSs listed in the boot configuration data store?

Castaway on Command-Prompt Island

How can I remotely run commands on a Windows Vista or Windows Server 2008 box?

Icacls: The New and Improved Cacls?

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.


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!



Solving PST Management Problems
In this white paper, read about the top PST issues and how to administer local/network PST files.

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

Transform Your Data Center at Brocade Conference 2008
Storage networking industry’s premier event at the MGM Grand, Las Vegas, September 22 - 24, 2008

Are You Litigation Ready?
Collecting and processing electronic data for e-discovery can be time-consuming and expose a business to significant legal risks. Get prepared with this free white paper

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