Register your product to gain access to bonus material or receive a coupon.
Windows Server® 2008 Portable Command Guide
MCTS 70-640, 70-642, 70-643, and MCITP 70-646, 70-647
Darril Gibson
All the MCTS 70-640, 70-642, 70-643, and MCITP 70-646, 70-647 Commands in One Compact, Portable Resource
Maximize your efficiency as a Windows Server 2008 administrator, and master the commands, keywords, command arguments, options, and prompts covered on Microsoft’s MCTS 70-640, MCTS 70-642, MCTS 70-643, MCITP 70-646, and MCITP 70-647 exams! This easy, handy reference brings together all the techniques, tips, tools, and examples you’ll need. It’s your perfect take-anywhere guide to running Windows Server 2008 and R2 environments—and passing Microsoft’s five key Windows Server 2008 administration exams.
Covers all the commands you need to score higher on your MCTS 70-640, 70-642, 70-643, and MCITP 70-646 and 70-647 exams!
Your Perfect Take-Anywhere Windows Server 2008 Command Resource!
Category: Microsoft Certification
Covers: Windows Server 2008 Exams (MCTS 70-640, 70-642, 70-643, and MCITP 70-646, 70-647)
Exam Profile: MCITP: Windows Server 2008, Server Administration (70-646)
Planning for Business Continuity and High Availability as it Applies to Exam 70-646
Retrieving Information from Active Directory with Dsquery and Dsget
Windows Server 2008 Portable Command Guide: Using ntdsutil
Download the sample pages (includes Chapter 12 and Index)
Introduction xvii
Part I: Command Prompt Basics
Chapter 1 Launching and Using the Command Prompt 1
Launching the Command Prompt 1
Launching with Elevated Privileges 2
Using the Built-in doskey Program 3
Creating Mini Macros with doskey 5
Cutting and Pasting to and from the Command Prompt 5
Copying from the Command Prompt Window 6
Pasting Data to the Command Prompt Window 6
Changing the Options and Display 7
Chapter 2 Basic Rules When Using the Command Prompt 9
Using Uppercase or Lowercase 9
Using Quotes 10
Understanding Variables 11
Understanding Switches 13
Understanding Wildcards 13
Getting Help 14
Understanding Paths 17
Using Basic Commands 18
Redirecting Output to Files 19
Chapter 3 Manipulating Files, Folders, and Shares 21
Copying Files with copy, xcopy, and robocopy 21
copy 21
xcopy 22
robocopy 23
Compressing Files with compact 26
Encrypting Files with cipher 27
Manipulating Shadow Copies with vssadmin 28
Manipulating Shares with net share 31
Mapping Drives with net use 32
Manipulating Users and Groups with the net Command 33
Modifying NTFS Permissions with icacls 34
Chapter 4 Creating Batch Files 37
Using Notepad 37
Giving Feedback with echo 38
Using Parameters 39
Calling Another Batch File with call 41
Clearing the Screen with cls 42
Changing the Order of Processing with goto 42
Checking Conditions with if 43
Part II: Managing and Troubleshooting DNS
Chapter 5 Using dnscmd 47
Retrieving DNS Information 47
Exporting DNS Data 49
Forcing Zone Transfers 49
Clearing the DNS Cache 49
Working with DNS Partitions 50
Adding DNS Zones 51
Creating and Deleting DNS Records 53
Chapter 6 Using nslookup 55
Verifying Records with nslookup 55
Configuring DNS for nslookup 58
Using nslookup Without PTR Records 59
Using nslookup Without a Reverse Lookup Zone 60
Part III: Managing and Troubleshooting Active Directory
Chapter 7 Using Basic ds Commands 63
Understanding Distinguished Names 63
Adding Objects with dsadd 65
Modifying Accounts with dsmod 67
Moving Accounts with dsmove 69
Removing Objects with dsrm 70
Chapter 8 Using Advanced ds Commands 71
Retrieving Information about Objects with dsquery 71
Retrieving Information About Objects with dsget 73
Viewing and Modifying AD Permissions with dsacls 75
Chapter 9 Promoting and Demoting a Domain Controller (DC) 77
Promoting a DC with dcpromo 77
Demoting a DC with dcpromo 79
Using dcpromo with an unattend File 80
Promoting a DC to an RODC with an Existing Account 81
Using dcpromo to Install from Media 83
Forcing Removal of Active Directory 84
Chapter 10 Working with the Schema 87
Modifying the Schema with adprep 87
Registering the Active Directory Schema Snap-In 88
Chapter 11 Working with Active Directory Accounts 91
Using ldifde to Export, Import, and Delete Accounts 91
Using csvde to Export and Import Accounts 95
Redirecting Computer Accounts 97
Redirecting User Accounts 98
Chapter 12 Using ntdsutil 101
Resetting the Directory Services Restore Mode Password 101
Changing the Garbage Collection Logging Level 102
Moving Active Directory to a Different Drive 103
Defragmenting Active Directory 104
Performing an Authoritative Restore 105
Removing a Domain Controller from Active Directory 107
Seizing an Operations Master Role 108
Chapter 13 Using netdom 111
Identifying Operations Master Roles 111
Joining a Computer to a Domain 111
Verifying Trust Relationships 113
Querying and Resetting Secure Channels with netdom 116
Chapter 14 Troubleshooting Replication 119
Checking Replication with repadmin 119
Forcing Replication with repadmin 121
Migrating to DFSR with dfsrmig 123
Part IV: Group Policy and the Command Line
Chapter 15 Group Policy Overview 127
Launching the Group Policy Management Console 127
Understanding Group Policy Order of Precedence 128
Filtering GPOs by Modifying Permissions 130
Understanding Group Policy Settings 132
Enabling Auditing Through Group Policy 132
Enabling Advanced Auditing for Directory Services Changes 134
Deploying Applications 135
Configuring Automatic Updates 137
Blocking Inheritance 138
Enforcing GPOs 138
Using Loopback Processing 139
Running Scripts with Group Policy 140
Chapter 16 Group Policy Command-Line Tools 143
Viewing Group Policy Settings with gpresult 143
Refreshing Group Policy Settings with gpupdate 146
Chapter 17 Security Configuration Wizard 149
Understanding the Security Configuration Wizard 149
Using scwcmd 151
Part V: Configuring Server Core
Chapter 18 Configuring Server Core after Installation 155
Installing Server Core 155
Restoring the Command Prompt 156
Renaming the Computer 157
Logging Off, Shutting Down, and Rebooting 158
Configuring TCP/IP 159
Setting the Time, Date, and Time Zone 160
Joining a Domain 161
Chapter 19 Adding Roles to Server Core 163
Understanding the Supported Roles 163
Using ocsetup to Add Roles to Windows Server 2008 164
Adding the DHCP Server Role with ocsetup 165
Adding the DNS Server Role with ocsetup 166
Adding File Services with ocsetup 166
Adding the Print Services Role with ocsetup 166
Adding the Web Server (IIS) Role with pkgmgr 166
Using dism to Add Roles to Windows Server 2008 R2 167
Adding the DHCP Server Role with dism 168
Adding the DNS Server Role with dism 168
Adding File Services with dism 169
Adding the Print and Document Services Role with dism 169
Adding the AD CS Role with dism 169
Adding the AD LDS Role with dism 169
Adding PowerShell with dism 170
Adding the AD DS Role 170
Chapter 20 Configuring Server Core for Remote Administration 171
Using the Server Core Registry Editor 171
Enabling Access with Remote Microsoft Management Consoles (MMCs) 173
Configuring the Firewall to Reply to Ping 175
Part VI: Managing and Maintaining Windows Server 2008 and Windows Server 2008 R2
Chapter 21 Manipulating Services 177
Stopping and Starting Services with the net Command 177
Manipulating Services with sc 178
Manipulating Services with wmic 181
Configuring the Firewall to Allow wmic 181
Using the wmic service list Command 182
Using the wmic service call Command 183
Chapter 22 Basic Routing on a Server 187
Viewing the Routing Table with route print 187
Adding Routes to the Routing Table with route add 189
Modifying Routes in the Routing Table with route change 191
Deleting Routes from the Routing Table with route delete 192
Chapter 23 Working with Printers 193
Publishing Printers to Active Directory with pubprn.vbs 193
Migrating Printers with printbrm 196
Controlling the Print Queue with prnqctl.vbs 197
Chapter 24 Licensing and Activation 201
Managing Activation Tasks with slmgr 201
Managing Basic Tasks with slmgr 201
Viewing License Information with slmgr 202
Managing KMS Servers with slmgr 203
Using KMS Activation Keys 204
Managing KMS Clients with slmgr 204
Forcing Registration of KMS Server SRV Records 205
Manually Creating an SRV Record for KMS 206
Chapter 25 Using netsh 209
Understanding netsh 209
Understanding netsh Contexts 210
Configuring IPv4 with netsh 214
Configuring an IPv6 Address with netsh 217
Disabling IPv6 in Windows Server 2008 218
Chapter 26 Working with Event Subscriptions 219
Enabling the Source Computer with winrm 219
Enabling the Collector Computer with wecutil 220
Adding an Account to the Event Log Readers Group 221
Enabling and Testing Event Subscriptions 223
Managing Subscriptions with wecutil 226
Logging Events with eventcreate 228
Chapter 27 Using wbadmin 231
Adding wbadmin to a Server 231
Backing Up System State Data with wbadmin 232
Restoring System State Data with wbadmin 233
Restoring System State Data on a Domain Controller with wbadmin 235
Backing Up Volumes with wbadmin 236
Restoring Volumes with wbadmin 238
Part VII: Troubleshooting Windows Server 2008 and Windows Server 2008 R2
Chapter 28 Troubleshooting Networking Issues 241
Viewing and Manipulating TCP/IP Configuration with ipconfig 241
Checking Connectivity with ping 247
Viewing the Router Path with tracert 251
Checking for Data Loss with pathping 251
Chapter 29 Using the Reliability and Performance Monitor 253
Gathering Information from the Reliability Monitor 253
Running System Data Collector Sets 256
Writing a Script to Run Data Collector Sets 258
Scheduling a Script to Run Data Collector Sets 259
Chapter 30 Using Network Monitor and nmcap 261
Installing Network Monitor 261
Starting and Using Network Monitor 262
Using nmcap to Capture Traffic 264
Automatically Starting, Stopping, and Terminating nmcap 265
Adding Filters to nmcap 267
Enabling Promiscuous Mode in nmcap 268
Part VIII: Terminal Services and Remote Desktop Services
Chapter 31 Remote Desktop Services 269
Adding the Remote Desktop Services Role 269
Viewing and Manipulating the Install Mode with change user 272
Modifying Logon Capabilities with change logon 272
Connecting and Disconnecting Sessions with tscon and tsdiscon 273
Identifying Open Sessions with query user or quser 274
Resetting Sessions with reset session 275
Chapter 32 Remote Administration 277
Configuring, Verifying, and Removing winrm 277
Using winrs to Issue Commands 278
Connecting to Remote Systems with mstsc 280
Part IX: Working with Some Server Roles from the Command Line
Chapter 33 Using Windows Deployment Services 283
Adding the WDS Role 283
Configuring the WDS Role 285
Adding Boot Images to WDS with wdsutil 285
Creating Image Groups Using wdsutil 286
Adding Install Images Using wdsutil 286
Configuring Server Properties Using wdsutil 288
Running the sysprep GUI 290
Running sysprep from the Command Line 291
Chapter 34 Manipulating IIS with appcmd 293
Managing Sites with appcmd 293
Adding a Site with appcmd 294
Adding an Application to a Site with add app 295
Adding a Virtual Directory with add vdir 295
Starting and Stopping Application Pools with appcmd and appcmd stop 296
Part X: Using Visual Basic Scripts (VB Script)
Chapter 35 Creating Basic Visual Basic Scripts 297
Working with filesystemobject 297
Accessing a Network Share with filesystemobject 300
Calling Scripts from a Batch File 300
Displaying a Message Box with a Visual Basic Script 300
Using if Statements 302
Checking for a Value with a Message Box 302
Chapter 36 Manipulating Active Directory with Visual Basic Scripts 305
Connecting to Active Directory with a VB Script 305
Creating an OU with a VB Script 305
Creating a User Account with a VB Script 306
Modifying the Tombstone Lifetime 307
Part XI: Using PowerShell
Chapter 37 Starting and Using PowerShell 311
Installing and Launching PowerShell 311
Understanding PowerShell Verbs and Nouns 312
Tabbing Through PowerShell Commands 316
Understanding the Different Types of PowerShell Commands 318
Creating Aliases 318
Discovering Windows PowerShell Commands 318
Exploring get-member 320
Redirecting Output with Windows PowerShell 322
Understanding PowerShell Errors 323
Understanding PowerShell Variables 324
Using Comparison Operators 327
Understanding Pipelining 327
Chapter 38 Creating and Running a PowerShell Script 331
Setting the Security Context 331
Creating a PowerShell Profile 332
Creating and Modifying the Global PowerShell Profile 334
Running PowerShell Scripts 336
Logging Processes with a get-process Script 337
Testing for the Existence of a File 338
Creating Output as HTML 340
Running a Script Against Multiple Computers 341
Scheduling PowerShell Scripts 344
Chapter 39 Using the Integrated Scripting Environment 347
Launching the ISE 347
Exploring the ISE 348
Executing Commands in the ISE 350
Creating and Saving a Script in the ISE 351
Chapter 40 Using PowerShell to Manage Active Directory 357
Using the Active Directory Module in Windows Server 2008 R2 357
Creating and Manipulating Objects in Windows Server 2008 359
Creating an OU with PowerShell 359
Creating a User with PowerShell 359
Moving Objects with PowerShell 360
Working with the Domain Object 361
Working with the system.directoryservices Namespace 362
Creating a List of Domain Computers 363
Appendix Create Your Own Journal Here 365
9780789747372 TOC 4/21/2011
Exam Ref MD-102 Microsoft Endpoint Administrator, 2nd Edition
Exam MD-102 Endpoint Administrator (Video), 2nd Edition, 2nd Edition
Exam DP-900: Microsoft Azure Data Fundamentals, Second Edition (Video), 2nd Edition
© 2025 Pearson Education, Pearson IT Certification. All rights reserved.
221 River Street, Hoboken, NJ 07030
Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Pearson IT Certification products and services that can be purchased through this site.
This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.
To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:
For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.
For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.
Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.
Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.
If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.
On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.
We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.
Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.
Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.
This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.
This site currently does not respond to Do Not Track signals.
Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.
This site is not directed to children under the age of 13.
Pearson may send or direct marketing communications to users, provided that
Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.
If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.
Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.pearsonitcertification.com/u.aspx.
Pearson does not rent or sell personal information in exchange for any payment of money.
While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.
California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.
Pearson may disclose personal information, as follows:
This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.
Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.
We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.
Last Update: November 17, 2020