Windows Administration at the Command Line for Windows 2003, Windows Vista, Windows XP, and Windows2000
Buy Rights Online Buy Rights

Rights Contact Login For More Details

  • Wiley

More About This Title Windows Administration at the Command Line for Windows 2003, Windows Vista, Windows XP, and Windows2000

English

As the only complete reference for Windows command line utilities, this book take an in-depth look at the often-overlooked utilities accessible through the command line in Windows Vista, 2003, XP, and 2000.  You’ll learn to locate files, check status, monitor systems, and save time by using scripts to automate time-consuming tasks. Plus, this is the only book on the market with the complete set of Windows command line utilities—including the latest for Vista—and offers solutions that will help increase your productivity.

English

John Paul Mueller, consultant, application developer, writer, and technical editor, has written over 300 articles and 72 books, including the recent Mastering Microsoft Web Developer 2005 Express Edition. His topics range from programming and operating systems to home security and accessibility. He has contributed articles to such magazines as DevSource, asp.netPro, InformIT, SQL Server Professional, and Visual C++ Developer, among others.
His Web site is www.mwt.net/~jmueller.

English

Introduction xxiii

Part 1 • Standard Windows Utilities 1

Chapter 1 • Using the Command Line Effectively 3

Understanding Why the Command Line Is So Important 4

The Command Line Made Easy 6

Using Utilities Directly 6

Writing Scripts 8

Scheduling Tasks 8

Relying on Third Party Utilities 8

Viewing the Commands by Purpose 8

Data Specific 9

System Status 9

File and Resource Management 10

Security and System Monitoring 10

Developer and Low-level Tasks 10

Active Directory 11

Services 11

Task Scheduling 12

Updating Your Current Utilities at the Microsoft Download Center 12

Configuring the Command Window 12

Setting the Window Options 13

Changing the Font 14

Choosing a Window Layout 14

Defining the Text Colors 14

Placing a Command Prompt at Your Fingertips 15

Understanding Internal Commands 17

Vista Changes for the Command Line 17

Understanding User Account Control (UAC) Changes 17

Overcoming UAC Problems 18

Giving Yourself Permission 18

Setting Vista Zones on Network Drives 19

Understanding Vista Doesn't Support Old Commands 20

Getting Started with Command Line Tasks 20

Chapter 2 • Completing Data-Specific Tasks 23

Creating and Modifying Data Files and Directories 24

Opening Remote Directories with the Append Utility 24

Copying Files with the Command 25

Removing Files with the Del and Erase Commands 27

Removing a Directory Tree with the DelTree Command 28

Modifying Files with the Edlin Utility 29

Repairing System Databases with the ESEnTUtl Utility 30

Decompressing Files with the Expand Utility 34

Creating Directories with the MD and MkDir Commands 35

Moving Files and Renaming Files and Directories with the Move Command 36

Setting and Viewing Application Paths with the Path Command 37

Storing and Retrieving Directories with the PushD and PopD Commands 38

Recovering Lost Files with the Recover Utility 39

Removing a Directory with the RD and RmDir Commands 39

Renaming a File or Directory with the Ren and Rename Commands 40

Replacing Existing Files with the Replace Utility 40

Sorting File Content with the Sort Utility 41

Associating a Folder to a Drive with the Subst Utility 43

Displaying a Directory Structure with the Tree Utility 44

Validating File Operations with the Verify Command .45

Performing Bulk File Transfers with the XCopy Utility 45

Performing Robust File Transfers with the RoboCopy Utility 47

Displaying Data Files 54

Working with Line Printers 54

Printing Data Files with the Print Utility 56

Outputting Data Files with the Type Command 57

Performing a Formatted Printout with Notepad 60

Determining File and Directory Status 61

Determining the Current Directory and Changing Directories with the CD and ChDir Commands 61

Comparing Two Files with the Comp Utility 62

Performing Advanced File Comparison with the FC Utility 62

Working with File Associations and Types 64

Taking Ownership of Files with the TakeOwn Utility 65

Performing Backups with the NTBackup Utility 66

Performing Backups with the WBAdmin Utility 68

Start Backup 69

Get Items 69

Working with ODBC Data Sources 70

Configuring the ODBC Environment with the ODBCConf Utility 70

Creating an ODBC Data Source at the Command Line 72

Managing the Windows Registry 72

Modifying the Registry with the RegEdit Utility 73

Scripting Registry Entries with the RegIni Utility 74

Adding and Removing Servers with the RegSvr32 Utility 74

Getting Started with Command Line Tasks 75

Chapter 3 • Discovering the System Status 77

Getting System Status Information 77

Obtaining Driver Information with the DriverQuery Utility 78

Obtaining DirectX Status with the DXDiag Utility 79

Monitoring the File System with the FSUtil Utility 80

Managing Volume Labels with the Label Utility 92

Determining Memory Status with the Mem Utility 92

Obtaining General System Information with the MSInfo32 Utility 93

Managing Environment Variables with the Set Command 96

Managing Environment Variables with the SetX Utility 98

Determining the Operating System Version with the Ver Command 100

Getting Volume Information with the Vol Command 100

Viewing the Volume Shadow Service Data with the VSSAdmin Utility 100

Working with Plug and Play (PnP) 101

Performing Unattended Driver Installation with the PnPUnattend Utility 101

Managing PnP Setups Using the PnPUtil Utility 101

Recording System Status Information 102

Managing System Events with the EventCreate Utility 102

Triggering System Events with the EventTriggers Utility 104

Managing Event Information with the WEvtUtil Utility 106

Working with Performance Information 111

Adding Performance Counters with the LodCtr Utility 111

Managing Performance Logs and Alerts with the LogMan Utility 112

Viewing the Results of Changes with the PerfMon Utility 116

Reconfiguring Performance Logs with the ReLog Utility 116

Tracking Performance with the TypePerf Utility 118

Removing Performance Counters with the UnlodCtr Utility 119

Assessing Your System with the WinSAT Utility 119

Getting Started with Command Line Tasks 120

Chapter 4 • Locating Files and Other Resources 121

Locating Files 121

Finding Files and Directories with the Dir Command 122

Finding Files and Directories with the Where Utility 124

Detecting Shared Open Files with the OpenFiles Utility 124

Locating Information in Files with the Find and FindStr Utilities 127

Monitoring Files 129

Changing File and Directory Attributes with the Attrib Utility 130

Changing File and Directory Access with the CACLs Utility 132

Changing File and Directory Access with the ICACLs Utility 134

Determining File and Directory Status with the ChkDsk Utility 136

Performing Boot Time Disk Checks with the ChkNTFS Utility 137

Encrypting Data with the Cipher Utility 139

Compressing Data with the Compact Utility 141

Working with Other Resources 143

Converting Program Groups with the GrpConv Utility 143

Managing Power Settings with the PowerCfg Utility 143

Working with Terminal Server 148

Obtaining Session Status Information with the Query Utility 153

Working with Remote Access Server 155

Setting Up a Telephony Client with the TCMSetup Utility 157

Communicating with Telnet 158

Managing the System Time with the W32Tm Utility 161

Getting Started with Command Line Tasks 165

Chapter 5 • Securing and Monitoring a System 167

Working with the Network 168

Managing the ATM Call Manager with the ATMAdm Utility 168

Getting the Media Access Control Information with the GetMAC Utility 168

Getting the NetWare Routing Information with the IPXRoute Utility 169

Managing WinHTTP Proxy Configuration with the ProxyCfg Utility 170

Managing the Network with the Net Utility 171

Discovering TCP/IP Diagnostic Tools 184

Managing FTP Servers with the FTP Utility 208

Working with Users 209

Monitoring Users with the AuditUsr Utility 210

Configuring Profiles the CMStP Utility 211

Obtaining Group Policy Results with the GPResult Utility 212

Managing Group Policies with the GPUpdate Utility 213

Sending Messages with the Msg Utility 214

Auditing User Access with the AuditPol Utility 214

Obtaining User Login Information with the QUser Utility 218

Discovering User Identity with the WhoAmI Utility 218

Virus and External Intrusion Protection 219

Removing Viruses with the BlastCln Utility 220

Managing the File System with the FltMC Utility 221

Detect and Remove Malicious Software with the MRT Utility 223

Verifying System Files with the SFC Utility 223

Verifying Drivers with the Verifier Utility 224

Configuring the System Setup 226

Managing the Boot Configuration with the BootCfg Utility 226

Managing the Boot Configuration with BCDEdit in Vista 228

Accessing the WinPE Network Installer with the NetCfg Utility 232

Accessing the Windows Package Manager with the PkgMgr Utility 232

Configuring Local Security Policies with the SecEdit Utility 233

Adding and Removing Applications with the SysOCMgr Utility 235

Adding and Removing Applications with the OCSetup Utility 235

Getting System Configuration Information with the SystemInfo Utility 236

Interacting with the Internet 237

Converting IIS Logs with the ConvLog Utility 237

Monitoring and Managing IIS with the IISReset Utility 238

Working with IP Version 6 238

Working with General Applications 240

Terminating Tasks with the TaskKill Utility 240

Listing Applications and Services with the TaskList Utility 242

Converting Event Trace Logs with the TraceRpt Utility 243

Perform System Diagnostics with DispDiag 245

Getting Started with Command Line Tasks 245

Chapter 6 • Using Developer and Low-Level Utilities 247

Working with Automated System Recovery 248

Backing Up and Restoring System Data with the ASR_Fmt Utility 249

Working with Logical Disks Using the ASR_LDM Utility 250

Working with Protected Files Using the ASR_PFU Utility 251

Using the Start Command 251

Performing Disk Maintenance 253

Managing Removable Storage with the RSM Utility 253

Converting FAT Partitions to NTFS with the Convert Utility 259

Improving Disk Access Performance with the Defrag Utility 260

Compressing Files with the Diantz and MakeCAB Utilities 261

Managing Partitions with the DiskPart Utility 262

Mounting a Volume with the MountVol Utility 267

Managing Disk Performance with the DiskPerf Utility 268

Managing RAID Setups Using the DiskRAID Utility 269

Employing Low-Level Utilities 269

Examining, Modifying, and Debugging Files with the Debug Utility 269

Converting Executables with the Exe2Bin Utility 270

Ensuring Proper Application Execution with the ForceDOS Utility 270

Terminating a Session Using the Logoff Utility 271

Performing System-Level Debugging with the NTSD Utility 271

Managing Compatibility Databases with SDBInst 275

Accessing Functions within DLLs 276

Uninstalling the Operating System with the OSUninst Utility 277

Controlling Services with the SC Utility 278

Shutting Down the System with the ShutDown Utility 282

Replicating COM+ Applications with the COMRepl Utility 284

Managing Type Libraries with the RegTLib Utility 284

Saving and Restoring System Restore Data with the SRDiag Utility 285

Performing Web-Based Enterprise Management Tasks 285

Administering Managed Object Format Files with the MOFComp Utility 286

Interacting with the WBEM Server with the WinMgmt Utility 287

Tracing WinSxS Behavior with the SxSTrace Utility 288

Getting Started with Command Line Tasks 288

Part 2 • Using Windows Automation 289

Chapter 7 • Creating CMD and BAT Files 291

Starting the Command Interpreter 291

Using the CMD Switches 292

Modifying Config.NT 297

Modifying AutoExec.NT 301

Modifying Application Behavior Using a PIF 305

Defining Application Compatibility with the SetVer Utility 308

Using Common DOS Utilities 309

Working at the Command Prompt 316

Redirecting Command Line Output to the Clipboard with the Clip Utility 316

Clearing the Display with the CLS Command 316

Managing User Names and Passwords with CmdKey 317

Changing Screen Colors with the Color Command 318

Working with the System Date Using the Date Command 319

Tracking Command Line Actions with the DosKey Utility 319

Obtaining Command Line Help with the Help Utility 321

Working with the System Time Using the Time Command 321

Changing the Command Window Title with the Title Command 322

Creating Batch Files 322

Using the Call Command 323

Using the Choice Command 324

Using the Echo Command 326

Using the Exit Command 327

Using the ForFiles Utility 327

Using the For Command 328

Using the Goto Command 330

Using the If Command 331

Using the Pause Command 334

Using the Prompt Command 334

Using the Rem Command 335

Using the Shift Command 335

Using the TimeOut Utility 335

Using the WaitFor Utility 336

Getting Started with Command Line Tasks 336

Chapter 8 • Working with Scripts 339

Understanding Scripting Languages 339

Learning the Basics of JavaScript 340

Learning the Basics of VBScript 341

Executing Scripts 342

Running Scripts with the CScript and WScript Utilities 342

Configuring the Host and Property Page Options 344

Scripting Networking Solutions with the NetSH Utility 344

Creating a Basic Script 349

Scripting the Command Line and System Environment 350

Scripting the Registry 352

Using the Scripting Objects 354

Working with the WScript Object 355

Working with the WScript.WshArguments Object 356

Working with the WScript.WshShell Object 356

Working with the WScript.WshNetwork Object 358

Impersonating a User with the RunAs Utility 359

Changing the Environment 360

Changing Logons, Ports, and Users with the Change Utility 360

Enabling or Disabling Session Logons with the ChgLogon Utility 361

Listing COM Port Mappings Using the ChgPort Utility 361

Modifying the Install Mode with the ChgUsr Utility 361

Getting Started with Command Line Tasks 361

Chapter 9 • Scripting for Active Directory 363

Discovering Helpful Active Directory Utilities 364

Managing Active Directory with the DSQuery Utility 365

Managing the Active Directory Database with the NTDSUtil Utility 371

Working with Objects 373

Creating New Objects Using the DSAdd Utility 373

Listing Objects Using the DSGet Utility 378

Editing Existing Objects Using the DSMod Utility 382

Moving Existing Objects Using the DSMove Utility 382

Deleting Objects Using the DSRm Utility 383

Working with Users, Groups, and Computers 383

Obtaining a User’s Logon Name 384

Obtaining a User’s Full Name 384

Discovering User Group Membership 384

Resetting a User’s Password 385

Displaying a List of Hostnames 385

Getting Started with Command Line Tasks 385

Chapter 10 • Using Task Scheduler Effectively 387

Starting and Stopping the Task Scheduler Service 388

Managing Tasks with the SchTasks Utility 389

Working with the AT Utility 395

Combining the AT Utility with Batch Files 396

Creating Script-Based Scheduler Activities 398

Getting Started with Command Line Tasks 401

Chapter 11 • After Hours Automation Scripting 403

Defining After Hours Task Candidates 403

Creating Message Queue Backups with the MQBkup Utility 405

Installing Applications with the MSIExec Utility 405

Designing and Testing the After Hours Batch File 409

Adding Debug Information to Batch Files 409

Identifying Batch Files and Their Actions 413

Using a Centralized Data Store 415

Designing and Testing the After Hours Script 417

Mapping a Network Drive 417

Creating a CSV File 420

Remote System Management 424

Creating Remote Connections with the MSTSC Utility 424

Performing Remote Windows Management with the WinRM Utility 425

Accessing a System with the WinRS Utility 428

Providing Fault Tolerance for an After Hours Batch or Script 429

Getting Started with Command Line Tasks 431

Part 3 • Relying on Third Party Automation 433

Chapter 12 • Obtaining Command Prompt Enhancers 435

Using XVI32 to View Files in Depth 435

Moving Data with Send To Toys 438

Checking File Integrity Using FCIV 439

Getting the Better XCopy with XXCopy 443

Working with Shell Extensions Using ShellExView 443

Examining Processes Using Process Explorer 445

Getting Started with Command Line Tasks 447

Chapter 13 • Increasing Productivity at the Command Line 449

Obtaining Additional Information with ToggIt Command Line Helper 450

Using Quick Shutdown to End a Session Fast 451

Creating a Friendlier Interface with PromptPal 453

Getting a More Functional Command Line with WinOne 454

Automating Email Using sendEmail 455

Viewing XML Files Using XML Notepad 2007 458

Getting Started with Command Line Tasks 459

Chapter 14 • Editing and Compiling Batch Files and Scripts 461

Editing All File Types with WinVi 461

Obtaining a Better Notepad with Notepad+ 463

Creating Executable Batch Files with Batch File Compiler 5.2 465

Develop and Compile Batch Files with Quick Batch File Compiler 466

Understanding JavaScript and VBScript Compilers 467

Understanding the JSC Compiler Supplied with .NET 469

Using the JSC Compiler 469

Creating a Simple Example 472

Working with the .NET Framework 472

Getting Started with Command Line Tasks 473

Part 4 • Working with the .NET Framework Utilities 475

Chapter 15 • Understanding the .NET Framework Versions 477

Locating the .NET Framework on Your System 478

Understanding the Concept of Side-by-Side Versions 481

Viewing the Assembly Folder 484

Discovering the Essential .NET Framework Assemblies 486

Getting Started with Command Line Tasks 488

Chapter 16 • Configuring the .NET Framework 489

Understanding .NET Framework Configuration 489

Working with the Global Assembly Cache 490

Understanding .NET Security 490

Working with Code Groups 494

Creating and Defining Permission Sets 495

Defining Policy Assemblies 496

Adding Configured Applications 496

Understanding the Use of CONFIG Files 497

Setting Policies Using the CASPol Utility 499

Placing Assemblies in the Global Assembly Cache with GACUtil 502

Installing Assemblies with the InstallUtil Utility 504

Registering Assemblies with the RegAsm Utility 505

Registering Services with the RegSvcs Utility 505

Using the .NET Framework 3.0 Utilities 506

Configuring COM+ Applications with the ComSvcConfig Utility .506

Installing and Configuring Windows Communication Foundation Using the ServiceModelReg Utility 508

Interacting with WS-AtomicTransaction Using the WSATConfig Utility 509

Getting Started with Command Line Tasks 510

Chapter 17 • Configuring ASP.NET 513

Locating ASP.NET Errors 513

Fixing Application Registration Errors 514

Fixing File Association Problems 514

Fixing Configuration Problems 517

Creating Web Applications with the ASPNet_Compiler Utility 518

Providing Multiple Browser Support with the ASPNet_RegBrowsers Utility 519

Adding ASP.NET Support to IIS with the ASPNet_RegIIS Utility 520

Adding ASP.NET Support to SQL Server with the ASPNet_RegSQL Utility 523

Using the Command Line 524

Working with the ASPNet_RegSQL Utility Wizard 526

Understanding the ASPNet_State Service 527

Getting Started with Command Line Tasks 528

Part 5 • Windows Vista Special Features Preview 529

Chapter 18 • Using Windows PowerShell 531

An Overview of Windows PowerShell 531

Why Use the Windows PowerShell? 532

Downloading and Installing Windows PowerShell 533

Understanding the Windows PowerShell Difference 533

Using the New Windows PowerShell Commands 536

Getting Started with Command Line Tasks 546

Chapter 19 • Working with Windows PowerShell 547

Using the PS Command Interpreter  548

Creating a Shell Extension with the Make-Shell Utility 550

Creating a Windows PowerShell Script 552

Creating a Simple Script 553

Running the Script 556

Creating a Windows PowerShell Cmdlet and Shell 558

Creating the Cmdlet Code 558

Compiling the Cmdlet Executable 560

Using the Make-Shell Utility to Create the Shell 561

Getting Started with Command Line Tasks 562

Appendix A • 52 Indispensable Command Line Tricks and Techniques 563

Appendix B • A Summary of New and Modified Commands in Vista 569

Glossary 575

Index 597

loading