Serviceanwendung SharePoint 2016
0 1 Minute 8 Jahren

Voraussetzung: Erstellung einer Benutzerprofildienstanwendung in SharePoint 2016

Wir benötigen die Benutzerprofildienstanwendung, um soziale Funktionen in SharePoint 2016 wie „Meine Websites“, Benutzerprofile usw. nutzen zu können. Dieses PowerShell-Skript erstellt die Benutzerprofildienstanwendung in SharePoint 2016.

PowerShell zum Erstellen einer Benutzerprofildienstanwendung in SharePoint 2016

Wenn Sie die Erstellung neuer Benutzerprofildienstanwendungen effizient automatisieren möchten, ist PowerShell genau das richtige Werkzeug. In diesem Beitrag zeige ich Schritt für Schritt, wie Sie mit PowerShell eine neue Benutzerprofildienstanwendung sauber und zuverlässig einrichten.

Achten Sie dabei, wenn Sie ihre Angaben definieren und deren Account Namen oder Bezeichnungen klar verständlich mit der Bezeichnung ist. Verwenden Sie auch eine Liste in Ihrem Passwort Tool, mit den einzelnen Angaben, wie unten unter #Configuration Parameters ersichtlich ist. Manchmal gibt es, dass die Administratoren und IT-Operatoren die Bezeichnungen verwechseln.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
   
#Configuration Parameters
$ServiceAppName = "<User Profile Service Application>"
$ServiceAppProxyName = "<User Profile Service Application Proxy>"
$AppPoolAccount = "<DNS-Namen\SP2016-Service-Account-Pool"
$AppPoolName = "<Serviceanwendugs-App-Pool>"
$DatabaseServer ="<SP2016-SQL-DatabaseServerName>"
$UserProfileDB = "Farm_Profile_DB"
$UserProfileSyncDB = "Farm_Profile_Sync_DB"
$UserProfileSocialDB = "Farm_Profile_Social_DB"
$MySiteHostLocation="https://mysite.sharepoint.cloud/"
 
Try {
    #Set the Error Action
    $ErrorActionPreference = "Stop"
    
    #Check if Managed account is registered already
    Write-Host -ForegroundColor Yellow "Checking if the Managed Accounts already exists"
    $AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
    if($AppPoolAccount -eq $null)
    {
        Write-Host "Please Enter the password for the Service Account..."
        $AppPoolCredentials = Get-Credential $AppPoolAccount
        $AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
    }
    
    #Check if the application pool exists already
    Write-Host -ForegroundColor Yellow "Checking if the Application Pool already exists"
    $AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
    if ($AppPool -eq $null)
    {
        Write-Host -ForegroundColor Green "Creating Application Pool..."
        $AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount
    }
    
    #Check if the Service application exists already
    Write-Host -ForegroundColor Yellow "Checking if User Profile Service Application exists already"
    $ServiceApplication = Get-SPServiceApplication -Name $ServiceAppName -ErrorAction SilentlyContinue
    if ($ServiceApplication -eq $null)
    {
        Write-Host -ForegroundColor Green "Creating User Profile Service  Application..."
        $ServiceApplication =  New-SPProfileServiceApplication -Name $ServiceAppName -ApplicationPool $AppPoolName -ProfileDBName $UserProfileDB -ProfileSyncDBName $UserProfileSyncDB -SocialDBName $UserProfileSocialDB -MySiteHostLocation $MySiteHostLocation
    }
    #Check if the Service application Proxy exists already
    $ServiceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq $ServiceAppProxyName}
    if ($ServiceAppProxy -eq $null)
    {
        #Create Proxy
        $ServiceApplicationProxy = New-SPProfileServiceApplicationProxy -Name $ServiceAppProxyName -ServiceApplication $ServiceApplication -DefaultProxyGroup       
    }
    #Start service instance
    $ServiceInstance  = Get-SPServiceInstance | Where-Object { $_.TypeName -eq "User Profile Service" }
    
    #Check the Service status
    if ($ServiceInstance.Status -ne "Online")
    {
        Write-Host -ForegroundColor Yellow "Starting the User Profile Service Instance..."
        Start-SPServiceInstance $ServiceInstance
    }
    
    Write-Host -ForegroundColor Green "User Profile Service Application created successfully!"
}
catch {
    Write-Host $_.Exception.Message -ForegroundColor Red
 }
 finally {
    #Reset the Error Action to Default
    $ErrorActionPreference = "Continue"
}

Nach erfolgreicher Ausführung des Skripts können Sie in der Zentraladministration unter Anwendungsverwaltung → Dienstanwendungen prüfen, ob die Benutzerprofildienstanwendung korrekt erstellt wurde.

Nächster Schritt: Jetzt konfigurieren Sie den Benutzerprofilimport bzw. die Synchronisierung, indem Sie eine neue Benutzerprofilverbindung anlegen und anschliessend einen vollständigen Profilimport starten. So fügen Sie eine neue Verbindung für den Benutzerprofilimport hinzu:

Kommentar verfassen

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden.