Wiley.com
Print this page Share

Windows Command Line Administration Instant Reference

ISBN: 978-0-470-65046-2
Paperback
576 pages
September 2010
List Price: US $29.99
Government Price: US $17.85
Enter Quantity:   Buy
Windows Command Line Administration Instant Reference (047065046X) cover image

Introduction xix

Part I: Command Line Basics 1


Chapter 1: Configuring the Local Machine 3


Configure the Command Window 4

Set the Window Options 4

Change the Font 7

Choose a Window Layout 8

Define the Text Colors 9

Set the Environment 10

Manage Environment Variables with the Set Command 10

Manage Environment Variables with the SetX Utility 13

Perform Common Tasks 16

Clear the Display 16

Determine the Operating System Version 16

Start an Application 16

Work with Services 18

Shut Down the System 19

Obtain Command Line Help 20

Chapter 2: Making Remote Connections 23

Configure the Remote System 24

Change Security and Basic Setup 25

Setup Remote Administrator 28

Use the Remote Desktop Connection Application 30

Create a Connection 30

Use a Saved Connection 35

Set the Display 35

Access Local Resources 36

Run a Configuration Program 38

Optimize Performance 38

Terminate a Session 39

Use the Start Menu 40

Use the Logoff Utility 40

Chapter 3: Automating Tasks 41

View and Manage Tasks Using Scheduled Tasks 42

Configure the Task Scheduler 43

View Tasks 44

Create New Tasks 46

Delete Existing Tasks 50

Manage Tasks Using the SchTasks Command 51

Use the /Create Switch 51

Use the /Delete Switch 53

Use the /Query Switch 53

Use the /Change Switch 54

Use the /Run Switch 54

Use the /End Switch 54

Part II: Managing Data 55

Chapter 4: Working with File and Directory Objects 57

Manage Directory Objects 58

Find Directories 58

Find Directories Using Patterns 59

View the Current Directory 60

Change the Current Directory 60

Create Directories 61

Move Directories 61

Rename Directories 61

Remove a Directory 62

Display a Directory Structure 62

Manage File Objects 63

Find Files 63

Find Files in Sorted Order 64

Find Files by Attribute 65

Find Files Using Patterns 66

Copy Files 68

Perform Bulk File Transfers 69

Remove Files 70

Move Files 71

Rename a File 71

Set File Attributes 71

Work with File Associations and Types 72

Determine File Associations 72

Create File Associations 73

Determine File Types 73

Create File Types 73

Make Data Links 74

Create Simple Hard Links 75

View Simple Hard Links 75

Delete Simple Hard Links 75

Create Hard Links Using the New Technique 76

Create Symbolic Links 76

Create Junctions 77

Chapter 5: Administering File and Directory Content 79

Execute Applications Anywhere 80

View Application Paths 80

Set Application Paths 80

Locate Information in Files 81

Find Simple Strings 81

Find Complex Strings 82

Display Files Containing Strings 82

Perform Case Insensitive Searches 83

Monitor the File System with the FSUtil Command 83

Control File System Behavior 83

Manage the Volume Dirty Bit 86

Obtain the File System Information Using FSInfo 87

Manage Quotas 88

Repair File System Errors 90

Display Data Files 92

Display a Data File on Screen 92

Employ Data Redirection 92

Display Data One Page at a Time 95

Chapter 6: Managing the Hard Drive 99

Save Hard Drive Space 101

Compress Data 101

Uncompress Data 102

View Compression Status 102

Manage the Volume 102

Get Volume Information 103

Manage Volume Labels 103

Format a Disk 103

Mount a Volume 104

Maintain the Volume 106

Determine File and Directory Status 106

Locate Bad Sectors 107

Perform Boot-Time Disk Checks 108

Improve Disk Access Performance 109

Manage Partitions 110

Start DiskPart 110

List the Objects 111

See Object Details 112

Select an Object 113

Rescan a Computer for Objects 114

Create a Partition 114

Create a Volume 116

Clean a Drive 117

Mark a Partition as Active 117

Mark a Partition as Inactive 118

Assign a Drive Letter 118

Remove a Drive Letter 119

Extend a Volume 119

Delete an Object 120

Exit DiskPart 120

Chapter 7: Securing the Data 121

Protect Data 122

Encrypt a File or Directory 122

View Encrypted Files and Directories 123

Encrypt Hidden Files 124

Back Up Recovery Keys and Certificates 125

Add a User to a File or Directory 125

Remove a User from a File or Directory 126

Decrypt a File or Directory 127

Change File and Directory Access 127

Obtain the DACL 127

Find an SID 130

Grant Permission 130

Deny Permission 131

Remove Permission 131

Set the Owner 132

Verify Security 132

Detect Shared Open Files 132

Use the Query Option 132

Use the Disconnect Option 133

Use the Local Option 134

Take Ownership of Files 134

Set Administrator Ownership 134

Set Other User Ownership 135

Part III: Managing the Network 137

Chapter 8: Managing the Network 139

Get the Media Access Control Information 140

Interact with the Network Using the Net Utility 141

Manage Users 141

Manage Accounts 143

Manage Domains and Local Groups 146

Manage Computers 149

View and Close Sessions 149

Perform Server Configuration 151

View Workstation Configuration 153

Manage Services 153

Manage Files 155

Obtain Help for the Net Utility 156

Manage Print Jobs 157

Manage Resources 158

Obtain Statistics 161

Configure Time Synchronization 163

Chapter 9: Working with TCP/IP 165

Manage the Internet Protocol 166

Display the IP Information 166

Renew Addresses for an Adapter 168

Clear the DNS Resolver Cache 168

Renew DHCP Addresses and Register DNS Names 169

Release a Connection 169

Use Basic Diagnostics 170

Check Connections 170

Trace Transmission Paths 171

Track the Network Path 172

Perform Detailed Network Diagnostics 173

Obtain a Copy of NetDiag 174

Perform a Test 175

Understand Diagnostics 175

Locate and Fix Minor Problems 177

Get Network Statistics 177

Display All Connections and Ports 177

Display Application Statistics 178

Display Ethernet Statistics 179

Display Protocol Information 179

Set a Refresh Interval 180

Manipulate the Network Routing Tables 180

Print the Routing Tables 180

Add a New Route 181

Change a Route 182

Delete a Route 183

Chapter 10: Creating System Connections 185

Perform Remote System Management 186

Create Remote Connections 186

Set Up a Telephony Client 190

Perform Remote Windows Management 191

Execute Commands on a Remote System 206

Work with Terminal Server 206

Obtain Process Information 206

Get Session Information 207

Terminate a Session 208

Disconnect an Active Session 208

End Processes 208

Shut Down the Terminal Server 209

Part IV: Interacting with Active Directory 211

Chapter 11: Configuring Directory Services 213

Manage Directory Services Using the WMIC NTDomain Alias 214

List the Objects 215

List Object Properties 215

Get an Object Property 216

Set an Object Property 217

Query an Association 217

Manage Active Directory with the DSQuery Utility 218

Interact with Servers 218

Interact with Users 220

Interact with Computers 223

Interact with Contacts 223

Interact with Groups 223

Interact with Organizational Units 224

Manage the Active Directory Database 225

Issue a Command 225

Use a Stream 226

Chapter 12: Working with Directory Objects 229

Create New Objects 230

Add a Computer 230

Add a Contact 231

Add a Group 233

Add an Organizational Unit 234

Add a User 234

Get Objects 238

List Computers 238

List Contacts 239

List Groups 240

List Organizational Units 241

List Servers 241

List Users 242

Edit Existing Objects 243

Modify Computer Data 244

Modify Contact Data 245

Modify Group Data 246

Modify Organizational Unit Data 246

Modify User Data 246

Move Existing Objects 248

Delete Existing Objects 248

Part V: Performing Diagnostics 251

Chapter 13: Monitoring System Events 253

Create Simple System Events 254

Trigger System Events 257

Create an Event 258

Delete an Event 261

Query an Event 261

Manage Event Information 262

Display a List of Publishers 262

Get a Publisher 262

Enumerate the Logs 263

Query Log Events 264

Get a Log 267

Get Log Status Information 267

Set a Log 267

Export a Log 269

Archive a Log 270

Clear a Log 270

Chapter 14: Monitoring System Performance 271

Add Performance Counters 272

Load a Performance Counter 272

Save Performance Counter Settings 273

Restore Performance Counter Settings 273

Manage Performance Logs and Alerts 274

Create a Performance Log 274

Start Collecting Data 276

Stop Collecting Data 276

Query a Collection 277

Update a Collection 277

Delete a Collection 278

Create New Performance Logs from Existing Logs 278

Remove Performance Counters 281

Convert Event Trace Logs 281

Part VI: Performing Maintenance 283

Chapter 15: Performing Basic Maintenance 285

Configure the Server 286

Understand the SQL Syntax of WMIC 287

Use Aliases in WMIC 290

Get Help in WMIC 302

Format Data in WMIC 306

Translate Data in WMIC 310

Activate Windows 311

Perform an Activation 311

Display the Activation Information 312

Change the Product Key 312

Manage the System Time 312

Update the Time 313

Configure a Time Source 313

Obtain Time Settings Information 314

Manage the Boot Configuration 315

Enumerate the Configurations 315

Get BCDEdit Help 316

Edit an Existing Boot Setting 317

Change the Boot Sequence 318

Set the Default Boot Item 318

Chapter 16: Managing System Users 319

Audit User Access 320

List the Policies 321

Get a Policy 322

Set a Policy 326

Perform a Backup 327

Perform a Restore 327

Clear an Audit Policy 328

Remove an Audit Policy 328

Work with Group Policies 328

Obtain Group Policy Results 328

Manage Group Policies 330

Obtain Session Status Information 331

Get Process Information 331

Get Session Information 331

Get User Information 332

Get Terminal Server Information 332

Get the User’s Identity 332

Obtain User Logon Information 333

Discover User Identity 333

Chapter 17: Securing the System 335

Add Virus and External Intrusion Protection 337

Remove Viruses 337

Detect and Remove Malicious Software 338

Verify System Files 339

Verify Drivers 340

Change the Verifier Settings 342

Configure Local Security Policies 344

Perform an Analysis 344

Configure Security Policies 345

Export Policies 345

Import Policies 346

Validate a Policy File 346

Work with General Applications 347

Use TaskKill and TaskList Filters 347

Terminate Tasks 350

List Applications 350

List Services 351

Chapter 18: Interacting with the Registry 353

Perform Basic Registry Tasks 354

Export a Registry Key 356

Import a Registry Key 357

Delete a Registry Key 357

Save the Registry 358

Restore the Registry 358

Use the SCRegEdit Script 358

Set Automatic Updates 359

Enable Terminal Services 359

Configure the IP Security (IPSec) Monitor 360

Manage the DNS Service Priority and Weight 361

Use the Command Line Reference 361

Manage the Registry 362

Understand the Registry Settings 362

Query a Registry Entry 363

Add a Registry Entry 364

Delete a Registry Entry 365

Copy a Registry Entry 366

Compare Registry Entries 366

Export Registry Entries 367

Import Registry Entries 367

Restore Registry Entries 368

Part VII: Creating Batch Files 369

Chapter 19: Changing the Batch File Environment 371

Use the CMD Switches 372

Configure the Command Interpreter in the Registry 375

Use Command Extensions 377

Modify Config.NT 380

Use ANSI.SYS to Control the Environment 382

Set the Command Interpreter Location 382

Run Character Mode Applications Only 383

Display the Config.NT Commands 383

Control the Expanded Memory EMM Entry 383

Set the Number of Accessible Files 384

Control Extended Memory with HIMEM.SYS 385

Modify AutoExec.NT 387

Set the Code Page Number with the CHCP Utility 387

Add DPMI Support Using the DosX Utility 388

Enable Graphics Character Support with the GrafTabl Utility 389

Save Memory Using the LH Command 389

Install the Network Redirector Using the ReDir Utility 389

Chapter 20: Working at the Command Prompt 391

Redirect Command Line Output to the Clipboard 392

Manage Usernames and Passwords 393

Display Usernames 393

Create Users 394

Delete Users 394

Change Screen Colors 395

Configure the System Date 396

Configure the System Time 396

Change the Command Window Title 397

Chapter 21: Creating and Testing Batch Files 399

Use Batch File Commands 400

Employ the Call Command 401

Employ the Choice Command 403

Employ the Echo Command 406

Employ the Exit Command 406

Employ the ForFiles Utility 407

Employ the For Command 409

Employ the GoTo Command 414

Employ the If Command 414

Employ the Pause Command 418

Employ the Prompt Command 418

Employ the Rem Command 419

Employ the TimeOut Utility 420

Test Batch Files 420

Add Debug Information to Batch Files 421

Identify Batch Files and Their Actions 425

Use a Centralized Data Store 428

Store and Retrieve Directories with the PushD and PopD Commands 430

Part VIII: Creating Scripts 433

Chapter 22: Discovering Scripting Basics 435

Use Scripting Languages 436

Learn the Basics of JavaScript 436

Learn the Basics of VBScript 438

Use the Windows Scripting File 439

Execute Scripts 442

Run Scripts with the CScript and WScript Utilities 442

Configure the Host and Property Page Options 444

Chapter 23: Using the Scripting Objects 447

Use the WScript Object 449

Use the WScript Properties 449

Use the WScript Methods 451

Use the WScript.WshArguments Object 454

Use the WScript.WshShell Object 455

Use the WScript.WshNetwork Object 457

Use the WScript.WshNetwork Properties 457

Use the WScript.WshNetwork Methods 458

Create a Basic Script 462

Script the Command Line and System Environment 463

Script the Registry 466

Create .LNK Files 468

Chapter 24: Creating Advanced Scripting Examples 471

Script Registry Entries 472

Script Networking Solutions 473

Discover the NetSH Helper List 473

Get NetSH Help 474

Execute NetSH Commands 476

Understand the Basic NetSH Contexts 476

Use the Root Context Commands 478

Impersonate a User 480

Change the Environment 481

Change Logons, Ports, and Users 481

Enable or Disable Session Logons Directly 482

List COM Port Mappings 482

Modify the Install Mode 482

Map a Network Drive 483

Create a .CSV File 487

Appendix A: Alphabetical Command List 493

Appendix B: Topical Command List 505

Appendix C: Listing of Best Practices 521

Always Verify the Data 522

Real Administrators Use Help 523

Test Your Theories on a Test System 524

Use Batch Files, Scripts, and Written Procedures 525

Make Backups 526

Perform User-Specific Changes during Downtime 526

Index 529

Back to Top