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.