1

When provisioning the User Profile Service Application via Powershell, we can not start the User Profile Synchronization Service, no matter what.

It gets stuck on starting, and after a while gets the status "Stopped".

We have checked all the pre-requisities, and run this script also: http://sharepointbjorn.com/2014/06/25/user-profile-synchronization-autofixer/

If we create the service application manually, then the "User Profile Synchronization Service" can be started.

Have been trying with a lot of different scripts from different blogs and Technet, but tested with this now.

$appPool = New-SPServiceApplicationPool -Name "UPS" -Account "SP2013\SP_ProfilesAppPool"

if($appPool -eq $null)
{
    Write-Host "App pool is null"
}
else
{
    $ups = New-SPProfileServiceApplication –Name "User Profile"  -ApplicationPool $appPool  -ProfileDBServer "SP2013Dev" -ProfileDBName "ProfilesDB"   -SocialDBServer "SP2013Dev" -SocialDBName "SocialDB"   -ProfileSyncDBServer "SP2013Dev" -ProfileSyncDBName "SyncDB"  -MySiteHostLocation "http://my.test.com:8081" 
}

$app = Get-SPServiceApplication -Name "User Profile"  

if($app -eq $null)
{   
    Write-Host "Null"
}
else
{
    New-SPProfileServiceApplicationProxy -Name "User Profile Proxy" -ServiceApplication $app
}

The service application gets created, the proxy gets created. The service application is clickable and looks good.

The databases are created, but the User Profile Synchronization Service will never start when provisioned with PowerShell.

1
  • what error you are getting? did you check the event log and ULS log?
    – Waqas Sarwar MVP
    Feb 5, 2015 at 14:22

1 Answer 1

1

The User Profile Synchronization Service must be provisioned by the farm account. So if you run your Powershell script using another account (the setup account typically), it will fail.

The solution is either:

1) To run your Powershell script using the farm account. Try shift+right click on Powershell shortcut -> "run as another user"; or directly log in to the server with the farm account (not a best practice, the farm account is a service account, we are not supposed to use it directly).

or

2) Launch the provisionning using another identity. See this post from Harbar for instance (I never tried this 'Start-Job' method): http://www.harbar.net/archive/2010/10/30/avoiding-the-default-schema-issue-when-creating-the-user-profile.aspx

Note: remember to temporarily add the farm account to the local Administrators group during provisionning.

1
  • I ended up using AutoSpInstaller.
    – Ilyas
    Feb 11, 2015 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.