The Windows command line is a mainstay for systems administrators. Yet, with all of the work I've done looking...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
at add-ons for Windows Server 2003, I've never reported on the most useful command-line functions that are built right into the system. These are useful in multiple contexts: when you need to do quick-and-dirty repair work, or when you want to write a batch script that might be called as a scheduled task or used as part of a larger job.
I've culled several of the most useful and not-always-well-understood commands from the Windows Server 2003 command line, and included links back to Microsoft's own documentation for each. In each case you can always pass the /? command-line switch to retrieve a list of all the available options for the command.
defrag. Of course. Instead of slogging through snap-ins in the MMC interface, use defrag from the command line to get a defrag cycle going on one of your server's drives. The command-line defrag tool can be invoked from a batch file, a scheduled task or any number of other contexts, and you get all the same behavior from the command-line version as you do in the snap-in. The only thing missing is the file-by-file fragmentation report
driverquery exports a handy (and detailed) list of all the available drivers currently installed in the system, along with whether they're kernel- or file-system drivers. The results can also be exported to a CSV for re-use in other applications, and you can poll remotely available systems for their driver manifests as well.
freedisk checks to see if there's a requested amount of free space on a local or remote drive. There's two nice things about this command. First of all, it uses natural language, so you can, for instance, type freedisk /D d: 50MB to see if there's 50MB of space free on D:. Secondly, it can be used to target any network-available computer, not just the current one, so you can perform batch queries with it quite elegantly.
fsutil is the equivalent of netsh for file system management. It lets you change behaviors for a given file system, manage the dirty bit on a volume, control hardlinks and reparse points, and tons of other things that you'd normally have to hack around in the Registry (or elsewhere) to get a handle on.
iisback.vbs One of several IIS-controlling command-line scripts that are installed by default in Windows 2003, this lets you make spot backups of your entire IIS installation's settings, including sites, ports and virtual directories. (However, it won't back up the actual files served up by IIS -- that's your job). The same script can be used to restore a previous IIS installation backup. (Note: You can't use this to back up an IIS installation and move it to another computer; for that, you'll need a third-party product like IIS Export).
iisreset can be used if IIS ever stops responding, or if you need to do a reset to clear out stale state information. IISRESET can also be used to force a reboot if IIS's services get stuck in an indeterminate state (which, mercifully, doesn't happen often anymore, but if it does, it's nice to have an escape hatch).
inuse lets you replace locked operating system files on the next reboot. If you need to manually upgrade something the system's got locked for exclusive access and you can't use a third-party unlocker tool to get around it, use this. (Note: Sometimes a file that can't be replaced is not an exclusive lock issue but a usage and ownership issue.)
openfiles lists all the files opened by network users, and lets you selectively disconnect them if need be. Note: You'll need to use the command to enable a global object list before you can track and disconnect files, and on a system with a lot of remotely opened files, this might slow things down a bit.
winpop lets you configure and control the POP3 mail server that's now included by default in Windows 2003. It's a nice lightweight way to manage mail if you're not inclined to install Exchange. (Note: This command is not included in Windows 2003 Small Business Server, which doesn't bundle the POP3 component.)
In closing, I should mention that the ancient MS-DOS DEBUG command is still available in Windows Server 2003 (and XP, too!), although its functionality has been reduced a great deal due to incompatibilities between it and its host OS. But it can be still useful as a way to do quick-and-dirty edits on a given binary file if you don't have anything else lying around; read the documentation in the link for a good rundown on what's changed and what's still functional.
About the author: Serdar Yegulalp is editor of the Windows Power Users Newsletter, which is devoted to hints, tips, tricks, news and goodies for Windows NT, Windows 2000 and Windows XP users and administrators. He has more than 10 years of Windows experience under his belt, and contributes regularly to SearchWinComputing.com and SearchSQLServer.com.
More information on this topic:
- Tip: How can I monitor SMTP traffic coming from all machines
- Topics: Admin tools
- RSS: Sign up for our RSS feed to receive expert advice every day.