Konfigurieren einer Dienstanwendung mithilfe eines Windows PowerShell-Skripts (SharePoint Server 2010)

 

Gilt für: SharePoint Foundation 2010, SharePoint Server 2010

Letztes Änderungsdatum des Themas: 2016-11-30

In diesem Artikel wird beschrieben, wie der Benutzer mithilfe eines Windows PowerShell-Skripts die Funktionalität des Konfigurations-Assistent für SharePoint-Produkte in Microsoft SharePoint Server 2010 replizieren kann.

Hinweis

Mit dem folgenden Windows PowerShell-Skript wird die meiste Funktionalität des Konfigurations-Assistent für SharePoint-Produkte mit Ausnahme des Anwendungsregistrierungsdiensts und des Lotus Notes-Connectors repliziert. Informationen zum Konfigurieren dieser beiden Dienste finden Sie unter Verwalten des Anwendungsregistrierungsdiensts (SharePoint Server 2010) bzw. Konfigurieren und Verwenden des Lotus Notes-Connectors (SharePoint Server 2010).

Der Konfigurations-Assistent für SharePoint-Produkte unterstützt Sie beim Erstellen und Konfigurieren der Farm. Mit diesem Assistenten werden mehrere Konfigurationsaufgaben automatisiert, u. a. das Erstellen der Konfigurationsdatenbank, das Installieren von Diensten, das Erstellen von Dienstanwendungen und Dienstanwendungsproxys sowie das Erstellen der Website für die Zentraladministration.

Weitere Informationen zum Bereitstellen einer Farm finden Sie unter Mehrere Server für eine dreistufige Farm (SharePoint Server 2010).

Der Konfigurations-Assistent für SharePoint-Produkte weist unter anderem die Einschränkung auf, dass zum Bereitstellen der Dienste in der Farm alle Schritte nacheinander ausgeführt werden müssen, bis der Konfigurations-Assistent für SharePoint-Produkte abgeschlossen ist. Alternativ kann ein Administrator mithilfe des folgenden Windows PowerShell-Skripts die auszuführenden Dienste auswählen, indem er den entsprechenden Code kopiert und in eine separate PS1-Datei einfügt.

Einige Dienste hängen von der Ausführung eines anderen Diensts ab, weshalb beide in Ihrer Version des Skripts vorhanden sein müssen. Beispielsweise muss für die Verwendung der Web Analytics-Berichte für den Web Analytics-Dienst der Statusdienst gestartet werden. In der folgenden Tabelle sind Dienste und deren abhängige Dienste aufgeführt.

Dienstname Abhängiger Dienst

Access Service

Keine

Business Data Connectivity-Dienst

Keine

Excel Services-Anwendung

Keine

Verwalteter Metadatenwebdienst

Keine

PerformancePoint-Dienst

Excel Services

Statusdienst

SharePoint Server-Suche

Dienst für die Erfassung von Verwendungs- und Integritätsdaten

Statusdienst

Keine

Secure Store Service

Keine

Dienst für die Erfassung von Verwendungs- und Integritätsdaten

Keine

Benutzerprofil-Synchronisierungsdienst

Keine

Visio-Grafikdienst

Statusdienst

Web Analytics-Dienst

Statusdienst

Word Automation Services

Keine

So konfigurieren Sie eine Dienstanwendung mithilfe eines Windows PowerShell-Skripts

  1. Stellen Sie sicher, dass die folgenden Mindestanforderungen erfüllt sind:

  2. Kopieren Sie folgenden Code, und fügen Sie ihn in einen Text-Editor wie Microsoft Editor ein.

    Hinweis

    $appPoolUserName verwendet das Beispielkonto CONTOSO\SAAppPoolAccount, das in ein innerhalb Ihrer Organisation gültiges Konto geändert werden muss.

    ################################################################################ 
    ## This script replicates most of the functionality found in the SharePoint Products Configuration Wizard## 
    ################################################################################ 
    
    
    Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue 
    
    ## Settings you may want to change ## 
    $databaseServerName = "sp2010dev.contoso.com"
    $searchServerName = $databaseServerName
    $saAppPoolName = "SharePoint Web Services"
    $appPoolUserName = "CONTOSO\SAAppPoolAccount"
    
    
    ## Service Application Service Names ## 
    $accesssSAName = "Access Services"
    $bcsSAName = "Business Data Connectivity Service"
    $excelSAName = "Excel Services Application"
    $metadataSAName = "Managed Metadata Web Service"
    $performancePointSAName = "PerformancePoint Service"
    $searchSAName = "SharePoint Server Search"
    $stateSAName = "State Service"
    $secureStoreSAName = "Secure Store Service"
    $usageSAName = "Usage and Health Data Collection Service"
    $userProfileSAName = "User Profile Synchronization Service"
    $visioSAName = "Visio Graphics Service"
    $WebAnalyticsSAName = "Web Analytics Service"
    $WordAutomationSAName = "Word Automation Services"
    
    
    
    $saAppPool = Get-SPServiceApplicationPool -Identity $saAppPoolName -EA 0 
    if($saAppPool -eq $null) 
    { 
      Write-Host "Creating Service Application Pool..."
    
      $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0 
      if($appPoolAccount -eq $null) 
      { 
          Write-Host "Please supply the password for the Service Account..."
          $appPoolCred = Get-Credential $appPoolUserName
          $appPoolAccount = New-SPManagedAccount -Credential $appPoolCred -EA 0 
      } 
    
      $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0 
    
      if($appPoolAccount -eq $null) 
      { 
        Write-Host "Cannot create or find the managed account $appPoolUserName, please ensure the account exists."
        Exit -1 
      } 
    
      New-SPServiceApplicationPool -Name $saAppPoolName -Account $appPoolAccount -EA 0 > $null
    
    } 
    
    
    
    
    Write-Host "Creating Usage Service and Proxy..."
    $serviceInstance = Get-SPUsageService
    New-SPUsageApplication -Name $usageSAName -DatabaseServer $databaseServerName -DatabaseName "UsageDB" -UsageService $serviceInstance > $null
    
    
    
    
    Write-Host "Creating Access Services and Proxy..."
    New-SPAccessServiceApplication -Name $accesssSAName -ApplicationPool $saAppPoolName > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Access Database Service"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating BCS Service and Proxy..."
    New-SPBusinessDataCatalogServiceApplication -Name $bcsSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName "BusinessDataCatalogDB" > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Business Data Connectivity Service"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating Excel Service..."
    New-SPExcelServiceApplication -name $excelSAName -ApplicationPool $saAppPoolName > $null
    Set-SPExcelFileLocation -Identity "http://" -ExcelServiceApplication $excelSAName -ExternalDataAllowed 2 -WorkbookSizeMax 10 -WarnOnDataRefresh:$true 
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Excel Calculation Services"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating Metadata Service and Proxy..."
    New-SPMetadataServiceApplication -Name $metadataSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName "MetadataDB" > $null
    New-SPMetadataServiceApplicationProxy -Name "$metadataSAName Proxy" -DefaultProxyGroup -ServiceApplication $metadataSAName > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Managed Metadata Web Service"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating Performance Point Service and Proxy..."
    New-SPPerformancePointServiceApplication -Name $performancePointSAName -ApplicationPool $saAppPoolName > $null
    New-SPPerformancePointServiceApplicationProxy -Default -Name "$performancePointSAName Proxy" -ServiceApplication $performancePointSAName > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "PerformancePoint Service"} | Start-SPServiceInstance > $null
    
    
    ##START SEARCH 
    
    Write-Host "Creating Search Service and Proxy..."
    Write-Host "  Starting Services..."
    Start-SPEnterpriseSearchServiceInstance $searchServerName
    Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName
    
    Write-Host "  Creating Search Application..."
    $searchApp = New-SPEnterpriseSearchServiceApplication -Name $searchSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName "SearchDB"
    $searchInstance = Get-SPEnterpriseSearchServiceInstance $searchServerName
    
    Write-Host "  Creating Administration Component..."
    $searchApp | Get-SPEnterpriseSearchAdministrationComponent | Set-SPEnterpriseSearchAdministrationComponent -SearchServiceInstance $searchInstance
    
    
    ##Crawl 
    Write-Host "  Creating Crawl Component..."
    $InitialCrawlTopology = $searchApp | Get-SPEnterpriseSearchCrawlTopology -Active
    $CrawlTopology = $searchApp | New-SPEnterpriseSearchCrawlTopology
    $CrawlDatabase = ([array]($searchApp | Get-SPEnterpriseSearchCrawlDatabase))[0] 
    $CrawlComponent = New-SPEnterpriseSearchCrawlComponent -CrawlTopology $CrawlTopology -CrawlDatabase $CrawlDatabase -SearchServiceInstance $searchInstance
    $CrawlTopology | Set-SPEnterpriseSearchCrawlTopology -Active
    
    Write-Host -ForegroundColor white "  Waiting for the old crawl topology to become inactive" -NoNewline
    do {write-host -NoNewline .;Start-Sleep 6;} while ($InitialCrawlTopology.State -ne "Inactive") 
    $InitialCrawlTopology | Remove-SPEnterpriseSearchCrawlTopology -Confirm:$false
    Write-Host
    
    
    
    ##Query 
    Write-Host "  Creating Query Component..."
    $InitialQueryTopology = $searchApp | Get-SPEnterpriseSearchQueryTopology -Active
    $QueryTopology = $searchApp | New-SPEnterpriseSearchQueryTopology -Partitions 1  
    $IndexPartition= (Get-SPEnterpriseSearchIndexPartition -QueryTopology $QueryTopology) 
    $QueryComponent = New-SPEnterpriseSearchQuerycomponent -QueryTopology $QueryTopology -IndexPartition $IndexPartition -SearchServiceInstance $searchInstance
    $PropertyDatabase = ([array]($searchApp | Get-SPEnterpriseSearchPropertyDatabase))[0]  
    $IndexPartition | Set-SPEnterpriseSearchIndexPartition -PropertyDatabase $PropertyDatabase
    $QueryTopology | Set-SPEnterpriseSearchQueryTopology -Active
    
    
    Write-Host "  Creating Proxy..."
    $searchAppProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$searchSAName Proxy" -SearchApplication $searchSAName > $null
    
    
    #####END SEARCH 
    
    
    Write-Host "Creating State Service and Proxy..."
    New-SPStateServiceDatabase -Name "StateServiceDB" -DatabaseServer $databaseServerName | New-SPStateServiceApplication -Name $stateSAName | New-SPStateServiceApplicationProxy -Name "$stateSAName Proxy" -DefaultProxyGroup > $null
    
    
    
    
    Write-Host "Creating Secure Store Service and Proxy..."
    New-SPSecureStoreServiceapplication -Name $secureStoreSAName -Sharing:$false -DatabaseServer $databaseServerName -DatabaseName "SecureStoreServiceAppDB" -ApplicationPool $saAppPoolName -auditingEnabled:$true -auditlogmaxsize 30 | New-SPSecureStoreServiceApplicationProxy -name "$secureStoreSAName Proxy" -DefaultProxygroup > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Secure Store Service"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating User Profile Service and Proxy..."
    $userProfileService = New-SPProfileServiceApplication -Name $userProfileSAName -ApplicationPool $saAppPoolName -ProfileDBServer $databaseServerName -ProfileDBName "ProfileDB" -SocialDBServer $databaseServerName -SocialDBName "SocialDB" -ProfileSyncDBServer $databaseServerName -ProfileSyncDBName "SyncDB"
    New-SPProfileServiceApplicationProxy -Name "$userProfileSAName Proxy" -ServiceApplication $userProfileService -DefaultProxyGroup > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "User Profile Service"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating Visio Graphics Service and Proxy..."
    New-SPVisioServiceApplication -Name $visioSAName -ApplicationPool $saAppPoolName > $null
    New-SPVisioServiceApplicationProxy -Name "$visioSAName Proxy" -ServiceApplication $visioSAName > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Visio Graphics Service"} | Start-SPServiceInstance > $null
    
    
    
    
    Write-Host "Creating Web Analytics Service and Proxy..."
    $stagerSubscription = "<StagingDatabases><StagingDatabase ServerName='$databaseServerName' DatabaseName='StagerDB'/></StagingDatabases>"
    $reportingSubscription = "<ReportingDatabases><ReportingDatabase ServerName='$databaseServerName' DatabaseName='WarehouseDB'/></ReportingDatabases>" 
    New-SPWebAnalyticsServiceApplication -Name $WebAnalyticsSAName -ApplicationPool $saAppPoolName -ReportingDataRetention 20 -SamplingRate 100 -ListOfReportingDatabases $reportingSubscription -ListOfStagingDatabases $stagerSubscription > $null  
    New-SPWebAnalyticsServiceApplicationProxy -Name "$WebAnalyticsSAName Proxy" -ServiceApplication $WebAnalyticsSAName > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Web Analytics Web Service"} | Start-SPServiceInstance > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Web Analytics Data Processing Service"} | Start-SPServiceInstance > $null
    
    
    
    Write-Host "Creating Word Conversion Service and Proxy..."
    New-SPWordConversionServiceApplication -Name $WordAutomationSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName "WordAutomationDB" -Default > $null
    Get-SPServiceInstance | where-object {$_.TypeName -eq "Word Automation Services"} | Start-SPServiceInstance > $null
    
  3. Speichern Sie die Datei unter dem Namen Services.ps1.

    Hinweis

    Sie können auch einen anderen Dateinamen wählen, wichtig ist, dass die Datei als ANSI-codierte Textdatei mit der Dateinamenerweiterung .ps1 gespeichert wird.

  4. Klicken Sie im Startmenüauf Alle Programme.

  5. Klicken Sie auf Microsoft SharePoint 2010-Produkte.

  6. Klicken Sie auf SharePoint 2010-Verwaltungsshell.

  7. Navigieren Sie zu dem Verzeichnis, in dem Sie die Datei gespeichert haben.

  8. Geben Sie an der Windows PowerShell-Eingabeaufforderung folgenden Befehl ein:

    ./Services.ps1 
    

Weitere Informationen zu Windows PowerShell-Skripts und PS1-Dateien finden Sie unter Ausführen von Windows PowerShell-Skripts.