Automating
Microsoft®
SharePoint®
2010
Administration
with Windows
PowerShell®
2.0
Gary Lapointe
Shannon
Bray
WILEYTABLE
B®S8®0©«4}®8#«l6&
OF
CONTENTS
Introduction
xxvPart
1Getting
Started With Windows Powershell Basics
1Chapter
1 Windows PowerShell 101 3Prepare
for YourJourney
4Automate SharePoint:AHistorical
Perspective
5From STSADMtoWindowsPowerShell 7
Understandthe Components 8
TheSharePoint 2010 ManagementShell 8
UnderstandRequiredPermissions 11
Windows PowerShell: An
Object-Based
Scripting Language 12Discover Cmdlets and
Objects
14Understand Variables andTypes 21
Declare and Use Variables 21
Understand
Object Types
22Declare andUseArraysand HashTables 28
Work withOutput 31
Understand the
Object
PipelineandPipeBind Objects
31 Format YourResults 35Chapter
2Filtering
and
Iterating
Your Data 39AddConditionalLogic 40
UseComparisonand
Logic Operators
—40Use the If/Elself/Else Statements 45
Use the SwitchStatement 47
Filter Your Data 49
Use the
Where-Object
Cmdlet 49Usethe
Sort-Object
Cmdlet 51Usethe
Select-Object
Cmdlet 53Iterate
Through
Your Data 57Use WhileLoops 57
UseDoWhileLoops 58
Use Do UntilLoops 59
Use ForLoops 59
Use ForeachLoops 61
XVI TABLE OF CONTENTS
Chapter
3Making
YourPowerShell Reusable
65ScriptYour Solutions 66
Create and Execute
Scripts
66Execute
Script
Blocks 70Define ScriptParameters 71
Comment YourScripts 74
Understandthe UseofFunctions 75
Create Functions 76
Define Function Parameters 79
Process
Pipeline
Data 81UnderstandScopes 82
CompartmentalizewithModules 85
Create and LoadScriptModules 86
Create Module Manifests 88
Add Error
Handling
toScripts 92Throw Errors 92
UseTrapBlocks 93
Use
Try/Catch/Finally
Blocks 97Understand
Object
DisposalIssues 100Part 2
Installing
and
Configuring
aSharePoint
2010 Environment 107Chapter
4Deploying
New Installations andUpgrades
109InstallSharePoint 2010 110
ReviewHelperFunctions 110
DefineXMLSettingsFile 113
Run theSharePoint2010 Server Installation Files 114
Run theScript 122
BuildaSharePoint 2010 Farm 123
Create andConfigure RequiredAccounts 124
Verify SQL Connectivity 125
Create XMLSettingsFile • 126
Review the Farm Build Cmdlets 127
Review the Central Administration Site Cmdlets 132
Run theScript 136
UpgradetoSharePoint 2010 137
SharePoint
Upgrade Approaches
137Perform
Pre-upgrade
Scan 139UpgradeContent Database 141
TABLE OF CONTENTS XVII
Chapter
5Configuring
ServerCommunications
145Configure
Intra-FarmCommunications 147Network 147
Windows Firewall 151
SQLServerandtheDatabases 156
WindowsServices 161
Configure
Inter-Server Communications 164 ActiveDirectory 164Chapter
6Configuring
FarmApplication
Settings
171ConfigureIPFS 172
Configure InfoPath Forms ServicesOptions 174
Configure
Administrator-Approved
FormTemplates
181ManageForm
Templates
, 184ManageData Connection Files 186
ConfigureWebService Proxies 187
Configure
ContentDeployment 188PreparetheEnvironment 189
ManageContent
Deployment
Jobs 193Configure
IncomingandOutgoing Email 199Configure
OutgoingEmail 200Configure
IncomingEmail 201Part 3
Deploying
andManaging Applications
207Chapter
7Managing
WebApplications
209Configure ApplicationPools , 210
Distinguish Typesof
Application
Pools 210List and Control
Application
Pool State 213CreateApplicationPools 217
Create and Extend Web
Applications
220CreateaNew Web
Application
221ExtendaWeb
Application
223Use XML Files forScriptingWeb
Applications
224Understand AlternateAccessMapping 226
CreateaNew IIS
Binding
229Adda NewAlternateAccess Mapping 229
EditIIS
Bindings
230Edit Alternate AccessMappings 231
Remove aBindingfrom IIS 232
XVIII TABLE OF CONTENTS
ConfigureWeb
Applications
234Modify
the GeneralSettings
ofaWebApplication
234Work with
Managed
Paths 243Implement Security
246Manage
Blocked FileTypes 246Manage UserPermissions 247
ManageWeb ApplicationPolicies 250
AccessWeb
Applications
from the Server 253Configurethe
DisableLoopbackCheck
Setting 254Configure
the BackConnectionHostNamesSetting 254Chapter
8Managing
SiteCollections
and Sites 257Understand Site Collections and Sites 258
Manage
Site Collections 260CreateaSite Collection 261
RetrieveaSite Collection 265
Modify
aSiteCollection 267DeleteaSite Collection 269
MoveaSite Collection 269
ManageSiteCollectionsas aFarmAdministrator 270
Manage
Sites 271 CreateaSite 272 RetrieveaSite 273 ModifyaSite 275 DeleteaSite 278 Configure Auditing 278Configure
AuditLogTrimming
279Configure
AuditSettings
for Documents and Items 280Configure
AuditSettings
forLists, Libraries,and Sites 281ManageQuotas and Locks 282
CreateaNew Quota
Template
283RetrieveQuota
Templates
283Apply
aQuotaTemplate
toaSite Collection 284Configure
Locks 285Manage
Security 287Manage
SharePointGroups 290ManageSharePointUsers 294
Create Permission Levels 301
Chapter
9Understanding
Authentication
303Understand the Various Forms of Authentication 304
TABLE OF CONTENTS XIX
Configure
Classic Mode WebApplications
310Configure
Secure SocketsLayer
311Configure
Kerberos 312Configure
ClaimsMode Authentication 315CreateaWeb
Application Using
ClaimsMode Authentication 315Configure
Forms-BasedAuthentication 317RetrieveanAuthentication Provider 320
ConfigureSharePointtoUseaClaim 321
Chapter
10Managing
Featuresand Solutions
329Deploy
andManage
Features 330Understand theComponentsofaFeature 331
Retrieve Features 335
InstallFeatures 339
Uninstall Features 341
Activate Features 342
Deactivate Features 343
Deploy
andManageFarm Solutions 345AddaFarm Solution 346
Deploy
aFarm Solution 347Retrieve Farm Solutions 349
RetractaFarm Solution 350
RemoveaFarm Solution 352
Update
aFarm Solution 352Start AdministrationJobs 354
RemoveaFarm SolutionDeploymentLock 355
Deploy
andManage
SandboxedSolutions 356The Solution
Gallery
357AddaSandboxed Solution 358
Deploy
aSandboxed Solution 359RetrieveSandboxedSolutions 360
RetractaSandboxedSolution 362
RemoveaSandboxed Solution 362
Update
aSandboxedSolution 363Part
4 Servicesand Service
Applications
367Chapter
11Managing
ServiceApplications
369Manage
Service Instances 371Retrieve Service Instances 371
Start Service Instances 373
Stop
Service Instances 375XX TABLE OF CONTENTS
Retrieve Service
Applications
377Create Service
Application
Pools 378Create Service
Applications
381Manage
ServiceApplication
Proxies 382RetrieveServiceApplication Proxies 382
CreateServiceApplicationProxies 383
Manage Proxy Groups 384
SecureService Applications 388
Retrieve ServiceApplicationAdministrators and Permissions 389 Set ServiceApplicationAdministratorsandPermissions 391
PublishandConsume ServiceApplicationsAcross Farms 394
ExportCertificates 396
Establish the Trust
Relationship
396Grant Permissions 397
PublishaService
Application
400Connectto aService
Application
401Chapter
12Provisioning
Support
Services 403Provision Web
Analytics
Services 404Provision the Web
Analytics
ServicesServiceApplication 405Test the Service
Application
412Provision StateServices 412
Provision theState ServicesServiceApplication 413
TesttheStateServices Service
Application
417Provision Secure Store Services 417
ProvisiontheSecure Store Services Service
Application
418 GenerateaSecureKey
422TesttheSecureStore Services Service
Application
423Provision UserCodeServices 423
Start the User Code Service 423
Setthe User Code Service
Identity
424Test the User Code Service 426
ProvisionClaimstoWindows TokenServices 426
Start the c2wts ServiceInstance 427
Set thec2wts
Identity
428Reset thec2wts
Identity
428Test the ClaimstoWindows Token Service 429
Provision
Usage
andHealthData Collection Services 430Provision the ServiceApplication 430
Provision the ServiceApplication
Proxy
431Configure
the Service Instance 432TABLE OF CONTENTS XXI
Chapter
13Provisioning
BusinessIntelligence,
Business
Connectivity,
and Word
Automation Services 437
Provision Excel Services 438
Provision the Excel Services ServiceApplication 439
Create theSecure StoreTarget Application 442
Test theServiceApplication 446
ProvisionAccessServices 448
Enable theSession State Service 449
Provision the Access Services Service
Application
451Test the ServiceApplication 454
Provision VisioGraphicsServices 456
Provision the Visio ServicesService
Application
457Create the Secure Store
Target Application
460Test the Service
Application
461Provision PerformancePointServices 462
Provision the PerformancePointServiceApplication 464
Set the UnattendedService Account 467
Test theService
Application
468Provision BusinessConnectivityServices 470
Provision theBCS ServiceApplication 471
Test theServiceApplication •.474
ProvisionWordAutomationServices 476
Provision theWord Automation Services Service
Application
476Test the Service
Application
479Chapter
14Provisioning
Search
Services 481Understand EnterpriseSearch
Concepts
482Understand Administration
Topology
Components 482Understand
Query Topology Components
483Understand Crawl
Topology Components
485Understand
Query
ProcessorComponents 486Understand ServicePlacement 487
Understand the
Crawling
Process 488RetrieveEnterpriseSearch Services 491
Retrieve theService
Application
492RetrievetheCrawl Components 492
Retrieve theQuery Components 493 Retrievethe Crawl Database 494 Retrieve thePropertyDatabase 495
ProvisionEnterpriseSearch Services 496
XXII TABLE OF CONTENTS
Start the ServiceInstance 497
Configure
the Search Service 499Create the ServiceApplication 501
Configure
the AdministrationComponent 504Createthe Crawl andQuery Components 506 Createthe Service
Application
Proxy 518PerformaFullorIncremental Crawl 519
ProvisionFoundationSearch Services 520
StarttheFoundationSearch Service 521
ExamineFoundationSearch ServicesSettings 526
StartandStopFull Crawls 526
Chapter
15Provisioning
Metadata and User Profile Services 527ProvisionManaged MetadataServices 528
Provision the
Managed
MetadataServicesService
Application
528Test the ServiceApplication 535
Provision User Profile Services 536
Provision the User Profile Services ServiceApplication 537
Test the ServiceApplication 545
Provision the User ProfileSynchronizationService 545
Test the
Synchronization
Service 548Address Common Issues 551
Part
5Managing
and
Maintaining
aSharePoint Environment
557Chapter
16Managing Operational Settings
559Manage Logging
560ReviewDiagnostic
Configuration
Settings 562Modify
DiagnosticConfiguration
Settings 563Review
Log
Levels 565Modify
LogLevels 567ResetLogLevels 568
Create New Log Files 569
Merge
Existing Log Files 569ReviewLogEvents 571 WriteLogEvents 573 Examinethe HealthAnalyzer 577
Review and
Modify
Rule Definitions 578 Review FailedRules 579ManageTimerJobs 581
ReviewTimer Jobs 581
ExecuteaTimer Job 583
TABLE OF CONTENTS XXIII
Understand the
Developer
Dashboard 585Overviewofthe
Developer
Dashboard 585Configure
theDeveloperDashboard 587Chapter
17 BackUp
and Restorea SharePoint Environment 591BackUpand RestoreaFarm 592
BackUpaFarm 593
BackUpanInactive Farm
Configuration
597Restorea Farm 600
RetrieveBackup History 603 BackUpand RestoreaSite Collection 605
BackUpaSiteCollection 605
RestoreaSite Collection 607
Export
andImportSites and Lists 609Export
aSiteorList 610Import
aSiteorList 613Chapter
18Optimizing
the Performance ofa SharePoint Environment 617Configure
ResourceThrottling
618Configure
PerformanceCounterMonitoring 620Monitor HTTP
Throttling
625Configure Caching Options 629
Configure Page Output Caching 629
Configure Object Caching 631
ConfigureBLOBCaching 634
Configure
Remote BLOBStorage 636ConfigureRBSinSQL Server 638
MigrateContent toAnother Provider 641
DisableRBS 642
Part 6
Advanced
Administration
643
Chapter
19 Remote Administration 645Use ClassicRemoting 646
Configure
Windows PowerShellRemoting 649Enable
Remoting
650Enable CredSSP 652
Increase
Memory
for Remote Sessions 654 ExecuteRemote Commands 655Use Invoke-Command 656
UseEnter-PSSession 661
Uselmport-PSSession 663
XXIV TABLE OF CONTENTS
Configure
Sessions 672CreateSession
Configurations
672SecureSession
Configurations
676Chapter
20Multi-Tenancy
679CreateaTenantHostingWebApplication 681
Create the WebApplication 683
Create theManaged Paths 684
ConfigureServiceApplications 685
Provision the
Subscription
SettingsService 685Configure
Tenant Services 688ManageFeature Packs and SiteSubscriptions 695
Manage
Feature Packs 696Manage
SiteSubscriptions
699Provision Tenants 701
CreateMember Sites 701
CreatetheTenantAdministrationSite 702
Configure
UserProfileandManagedMetadataService