Automating Microsoft SharePoint 2010 Administration with Windows PowerShell 2.0 Gary Lapointe Shannon Bray WILEY Wiley Publishing, Inc.
TABLE OF CONTENTS B S8 0 «4} 8#«l6& Introduction xxv Part 1 Getting Started With Windows Powershell Basics 1 Chapter 1 Windows PowerShell 101 3 Prepare for Your Journey 4 Automate SharePoint: A Historical Perspective 5 From STSADM to Windows PowerShell 7 Understand the Components 8 The SharePoint 2010 Management Shell 8 Understand Required Permissions 11 Windows PowerShell: An Object-Based Scripting Language 12 Discover Cmdlets and Objects 14 Understand Variables and Types 21 Declare and Use Variables 21 Understand Object Types 22 Declare and Use Arrays and Hash Tables 28 Work with Output 31 Understand the Object Pipeline and PipeBind Objects 31 Format Your Results 35 Chapter 2 Filtering and Iterating Your Data 39 Add Conditional Logic 40 Use Comparison and Logic Operators 40 Use the If/Elself/Else Statements 45 Use the Switch Statement 47 Filter Your Data 49 Use the Where-Object Cmdlet 49 Use the Sort-Object Cmdlet 51 Use the Select-Object Cmdlet 53 Iterate Through Your Data 57 Use While Loops 57 Use Do While Loops 58 Use Do Until Loops 59 Use For Loops 59 Use Foreach Loops 61 Use the ForEach-Object Cmdlet 61
XVI TABLE OF CONTENTS Chapter 3 Making Your PowerShell Reusable 65 Script Your Solutions 66 Create and Execute Scripts 66 Execute Script Blocks 70 Define Script Parameters 71 Comment Your Scripts 74 Understand the Use of Functions 75 Create Functions 76 Define Function Parameters 79 Process Pipeline Data 81 Understand Scopes 82 Compartmentalize with Modules 85 Create and Load Script Modules 86 Create Module Manifests 88 Add Error Handling to Scripts 92 Throw Errors 92 Use Trap Blocks 93 Use Try/Catch/Finally Blocks 97 Understand Object Disposal Issues 100 Part 2 Installing and Configuring a SharePoint 2010 Environment 107 Chapter 4 Deploying New Installations and Upgrades 109 Install SharePoint 2010 110 Review Helper Functions 110 Define XML Settings File 113 Run the SharePoint 2010 Server Installation Files 114 Run the Script 122 Build a SharePoint 2010 Farm 123 Create and Configure Required Accounts 124 Verify SQL Connectivity 125 Create XML Settings File 126 Review the Farm Build Cmdlets 127 Review the Central Administration Site Cmdlets 132 Run the Script 136 Upgrade to SharePoint 2010 137 SharePoint Upgrade Approaches 137 Perform Pre-upgrade Scan 139 Upgrade Content Database 141 Upgrade the SharePoint Look and Feel 143
TABLE OF CONTENTS XVII Chapter 5 Configuring Server Communications 145 Configure Intra-Farm Communications 147 Network 147 Windows Firewall 151 SQL Server and the Databases 156 Windows Services 161 Configure Inter-Server Communications 164 Active Directory 164 Chapter 6 Configuring Farm Application Settings 171 Configure IPFS 172 Configure InfoPath Forms Services Options 174 Configure Administrator-Approved Form Templates 181 Manage Form Templates, 184 Manage Data Connection Files 186 Configure Web Service Proxies 187 Configure Content Deployment 188 Prepare the Environment 189 Manage Content Deployment Jobs 193 Configure Incoming and Outgoing Email 199 Configure Outgoing Email 200 Configure Incoming Email 201 Part 3 Deploying and Managing Applications 207 Chapter 7 Managing Web Applications 209 Configure Application Pools, 210 Distinguish Types of Application Pools 210 List and Control Application Pool State 213 Create Application Pools 217 Create and Extend Web Applications 220 Create a New Web Application 221 Extend a Web Application 223 Use XML Files for Scripting Web Applications 224 Understand Alternate Access Mapping 226 Create a New IIS Binding 229 Add a New Alternate Access Mapping 229 Edit IIS Bindings 230 Edit Alternate Access Mappings 231 Remove a Binding from IIS 232 Remove an Alternate Access Mapping 233
XVIII TABLE OF CONTENTS Configure Web Applications 234 Modify the General Settings of a Web Application 234 Work with Managed Paths 243 Implement Security 246 Manage Blocked File Types 246 Manage User Permissions 247 Manage Web Application Policies 250 Access Web Applications from the Server 253 Configure the DisableLoopbackCheck Setting 254 Configure the BackConnectionHostNames Setting 254 Chapter 8 Managing Site Collections and Sites 257 Understand Site Collections and Sites 258 Manage Site Collections 260 Create a Site Collection 261 Retrieve a Site Collection 265 Modify a Site Collection 267 Delete a Site Collection 269 Move a Site Collection 269 Manage Site Collections as a Farm Administrator 270 Manage Sites 271 Create a Site 272 Retrieve a Site 273 Modify a Site 275 Delete a Site 278 Configure Auditing 278 Configure Audit Log Trimming 279 Configure Audit Settings for Documents and Items 280 Configure Audit Settings for Lists, Libraries, and Sites 281 Manage Quotas and Locks 282 Create a New Quota Template 283 Retrieve Quota Templates 283 Apply a Quota Template to a Site Collection 284 Configure Locks 285 Manage Security 287 Manage SharePoint Groups 290 Manage SharePoint Users 294 Create Permission Levels 301 Chapter 9 Understanding Authentication 303 Understand the Various Forms of Authentication 304 Configure Classic Mode Authentication 310
TABLE OF CONTENTS XIX Configure Classic Mode Web Applications 310 Configure Secure Sockets Layer 311 Configure Kerberos 312 Configure Claims Mode Authentication 315 Create a Web Application Using Claims Mode Authentication 315 Configure Forms-Based Authentication 317 Retrieve an Authentication Provider 320 Configure SharePoint to Use a Claim 321 Chapter 10 Managing Features and Solutions 329 Deploy and Manage Features 330 Understand the Components of a Feature 331 Retrieve Features 335 Install Features 339 Uninstall Features 341 Activate Features 342 Deactivate Features 343 Deploy and Manage Farm Solutions 345 Add a Farm Solution 346 Deploy a Farm Solution 347 Retrieve Farm Solutions 349 Retract a Farm Solution 350 Remove a Farm Solution 352 Update a Farm Solution 352 Start Administration Jobs 354 Remove a Farm Solution Deployment Lock 355 Deploy and Manage Sandboxed Solutions 356 The Solution Gallery 357 Add a Sandboxed Solution 358 Deploy a Sandboxed Solution 359 Retrieve Sandboxed Solutions 360 Retract a Sandboxed Solution 362 Remove a Sandboxed Solution 362 Update a Sandboxed Solution 363 Part 4 Services and Service Applications 367 Chapter 11 Managing Service Applications 369 Manage Service Instances 371 Retrieve Service Instances 371 Start Service Instances 373 Stop Service Instances 375 Manage Service Applications 376
XX TABLE OF CONTENTS Retrieve Service Applications 377 Create Service Application Pools 378 Create Service Applications 381 Manage Service Application Proxies 382 Retrieve Service Application Proxies 382 Create Service Application Proxies 383 Manage Proxy Groups 384 Secure Service Applications 388 Retrieve Service Application Administrators and Permissions 389 Set Service Application Administrators and Permissions 391 Publish and Consume Service Applications Across Farms 394 Export Certificates 396 Establish the Trust Relationship 396 Grant Permissions 397 Publish a Service Application 400 Connect to a Service Application 401 Chapter 12 Provisioning Support Services 403 Provision Web Analytics Services 404 Provision the Web Analytics Services Service Application 405 Test the Service Application 412 Provision State Services 412 Provision the State Services Service Application 413 Test the State Services Service Application 417 Provision Secure Store Services 417 Provision the Secure Store Services Service Application 418 Generate a Secure Key 422 Test the Secure Store Services Service Application 423 Provision User Code Services 423 Start the User Code Service 423 Set the User Code Service Identity 424 Test the User Code Service 426 Provision Claims to Windows Token Services 426 Start the c2wts Service Instance 427 Set the c2wts Identity 428 Reset the c2wts Identity 428 Test the Claims to Windows Token Service 429 Provision Usage and Health Data Collection Services 430 Provision the Service Application 430 Provision the Service Application Proxy 431 Configure the Service Instance 432 Configure Usage Definitions 434
TABLE OF CONTENTS XXI Chapter 13 Provisioning Business Intelligence, Business Connectivity, and Word Automation Services 437 Provision Excel Services 438 Provision the Excel Services Service Application 439 Create the Secure Store Target Application 442 Test the Service Application 446 Provision Access Services 448 Enable the Session State Service 449 Provision the Access Services Service Application 451 Test the Service Application 454 Provision Visio Graphics Services 456 Provision the Visio Services Service Application 457 Create the Secure Store Target Application 460 Test the Service Application 461 Provision PerformancePoint Services 462 Provision the PerformancePoint Service Application 464 Set the Unattended Service Account 467 Test the Service Application 468 Provision Business Connectivity Services 470 Provision the BCS Service Application 471 Test the Service Application.474 Provision Word Automation Services 476 Provision the Word Automation Services Service Application 476 Test the Service Application 479 Chapter 14 Provisioning Search Services 481 Understand Enterprise Search Concepts 482 Understand Administration Topology Components 482 Understand Query Topology Components 483 Understand Crawl Topology Components 485 Understand Query Processor Components 486 Understand Service Placement 487 Understand the Crawling Process 488 Retrieve Enterprise Search Services 491 Retrieve the Service Application 492 Retrieve the Crawl Components 492 Retrieve the Query Components 493 Retrieve the Crawl Database 494 Retrieve the Property Database 495 Provision Enterprise Search Services 496 Define Service Accounts 496
XXII TABLE OF CONTENTS Start the Service Instance 497 Configure the Search Service 499 Create the Service Application 501 Configure the Administration Component 504 Create the Crawl and Query Components 506 Create the Service Application Proxy 518 Perform a Full or Incremental Crawl 519 Provision Foundation Search Services 520 Start the Foundation Search Service 521 Examine Foundation Search Services Settings 526 Start and Stop Full Crawls 526 Chapter 15 Provisioning Metadata and User Profile Services 527 Provision Managed Metadata Services 528 Provision the Managed Metadata Services Service Application 528 Test the Service Application 535 Provision User Profile Services 536 Provision the User Profile Services Service Application 537 Test the Service Application 545 Provision the User Profile Synchronization Service 545 Test the Synchronization Service 548 Address Common Issues 551 Part 5 Managing and Maintaining a SharePoint Environment 557 Chapter 16 Managing Operational Settings 559 Manage Logging 560 Review Diagnostic Configuration Settings 562 Modify Diagnostic Configuration Settings 563 Review Log Levels 565 Modify Log Levels 567 Reset Log Levels 568 Create New Log Files 569 Merge Existing Log Files 569 Review Log Events 571 Write Log Events 573 Examine the Health Analyzer 577 Review and Modify Rule Definitions 578 Review Failed Rules 579 Manage Timer Jobs 581 Review Timer Jobs 581 Execute a Timer Job 583 Modify Timer Jobs 584
TABLE OF CONTENTS XXIII Understand the Developer Dashboard 585 Overview of the Developer Dashboard 585 Configure the Developer Dashboard 587 Chapter 17 Back Up and Restore a SharePoint Environment 591 Back Up and Restore a Farm 592 Back Up a Farm 593 Back Up an Inactive Farm Configuration 597 Restore a Farm 600 Retrieve Backup History 603 Back Up and Restore a Site Collection 605 Back Up a Site Collection 605 Restore a Site Collection 607 Export and Import Sites and Lists 609 Export a Site or List 610 Import a Site or List 613 Chapter 18 Optimizing the Performance of a SharePoint Environment 617 Configure Resource Throttling 618 Configure Performance Counter Monitoring 620 Monitor HTTP Throttling 625 Configure Caching Options 629 Configure Page Output Caching 629 Configure Object Caching 631 Configure BLOB Caching 634 Configure Remote BLOB Storage 636 Configure RBS in SQL Server 638 Migrate Content to Another Provider 641 Disable RBS 642 Part 6 Advanced Administration 643 Chapter 19 Remote Administration 645 Use Classic Remoting 646 Configure Windows PowerShell Remoting 649 Enable Remoting 650 Enable CredSSP 652 Increase Memory for Remote Sessions 654 Execute Remote Commands 655 Use Invoke-Command 656 Use Enter-PSSession 661 Uselmport-PSSession 663 Understand Serialization 668
XXIV TABLE OF CONTENTS Configure Sessions 672 Create Session Configurations 672 Secure Session Configurations 676 Chapter 20 Multi-Tenancy 679 Create a Tenant Hosting Web Application 681 Create the Web Application 683 Create the Managed Paths 684 Configure Service Applications 685 Provision the Subscription Settings Service 685 Configure Tenant Services 688 Manage Feature Packs and Site Subscriptions 695 Manage Feature Packs 696 Manage Site Subscriptions 699 Provision Tenants 701 Create Member Sites 701 Create the Tenant Administration Site 702 Configure User Profile and Managed Metadata Service Applications 703 Store Tenant Information 705 Index 707