This project has moved and is read-only. For the latest updates, please go here.

User Profile Service App Problem

May 10, 2011 at 4:02 PM

Hi all,

Firstly, I'd just like to say what a great tool the installer is; excellent work!

However, I'm currently haviing trouble with the code that provisions the user profile service.

Other than warning me to apply the update to fix FBA, the script runs fine until it comes to provision the User Profile Service Application. A second PowerShell window is spawned that eventually displays the following messages:

Creating User Profile Service Application as testdom\sp-Farm...
New-SPProfileServiceApplication : An update conflict has occurred, and you must
 re-try this action. The object UserProfileApplication Name=User Profile Servic
e Application was updated by TESTDOM\sp-setup, in the powershell (1740) process
, on machine SP01.  View the tracing log for more information about the conflic
At C:\AutoSPInstaller-ScriptBlock.ps1:3 char:56
+ $NewProfileServiceApp = New-SPProfileServiceApplication <<<<  -Name "User Pro
file Service Application" -ApplicationPool "SharePoint Hosted Services" -Profil
eDBName SP01_ProfileDB -ProfileSyncDBName SP01_SyncDB -SocialDBName SP01_Social
DB -MySiteHostLocation "http://SP01:8080"
    + CategoryInfo          : InvalidData: (Microsoft.Offic...viceApplication:
   SPCmdletNewProfileServiceApplication) [New-SPProfileServiceApplication], S
    + FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.

C:\AutoSPInstaller-ScriptBlock.ps1 :  - Failed to create User Profile Service A
At line:1 char:35
+ C:\AutoSPInstaller-ScriptBlock.ps1 <<<<
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio

Press any key to exit...

Meanwhile the main script window sits waiting for the above to finish and slowly fills up with:

 - Updating User Profile Synchronization Service to run as TESTDOM\sp-ServiceAcc
 - Waiting for User Profile Synchronization Service...
 - Waiting for User Profile Synchronization Service to be started....Provisioning
 - Provisioning User Profile Sync Service, please wait..........................

Can anyone point me in the right direction please?




May 16, 2011 at 1:07 PM

Similar issue here.

The second window closed by itself, but I'm only getting the dots......


ULS Viewer shows ad infinitum.

05/16/2011 14:06:02.61    powershell.exe (0x0914)    0x0AE0    SharePoint Foundation    PowerShell    6tf0    Medium    Entering ProcessRecord Method of Get-SPServiceInstance.    06e3e0c7-a601-4ab5-b76c-1d09b5483e0b
05/16/2011 14:06:02.61    powershell.exe (0x0914)    0x0AE0    SharePoint Foundation    PowerShell    6tf0    Medium    Leaving ProcessRecord Method of Get-SPServiceInstance.    06e3e0c7-a601-4ab5-b76c-1d09b5483e0b
05/16/2011 14:06:02.61    powershell.exe (0x0914)    0x0AE0    SharePoint Foundation    PowerShell    6tf0    Medium    Entering EndProcessing Method of Get-SPServiceInstance.    06e3e0c7-a601-4ab5-b76c-1d09b5483e0b
05/16/2011 14:06:02.61    powershell.exe (0x0914)    0x0AE0    SharePoint Foundation    PowerShell    6tf0    Medium    Leaving EndProcessing Method of Get-SPServiceInstance.    06e3e0c7-a601-4ab5-b76c-1d09b5483e0b


What next?




May 17, 2011 at 3:01 AM

Not sure exactly what's going on with the original issue, but for troubleshooting with ULSViewer, you will want to filter by category "User Profiles" - or at least, filter out the Powershell stuff. The entries you posted above just represents the While loop that fills the screen with dots... :-)


May 18, 2011 at 12:23 PM

Hi all,

I've just tried another install, with no changes to any of the config files, and everything worked smoothly, including Profile Sync.

If it ain't broke...




Jul 20, 2011 at 4:50 PM

I've just had the same issue - having seen it work fine last time round, with no changes made to the config files.

I've gone back to a snapshot, and I'll try again.



Jul 20, 2011 at 5:40 PM

Same problem again.  From the bottom of the ULS log - hope this means something:


Exception occured while connecting to WCF endpoint: System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.     at System.Net.HttpWebRequest.GetResponse()     at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)     --- End of inner exception stack trace ---    Server stack trace:      at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory)     at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)     at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)     at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)     at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)     at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)     at Microsoft.Office.Server.UserProfiles.IProfilePropertyService.GetProfileProperties()     at Microsoft.Office.Server.UserProfiles.ProfilePropertyServiceClient.<>c__DisplayClass1.<GetProfileProperties>b__0(IProfilePropertyService channel)     at Microsoft.Office.Server.UserProfiles.MossClientBase`1.ExecuteOnChannel(String operationName, CodeBlock codeBlock) UserProfileApplicationProxy.InitializePropertyCache: Microsoft.Office.Server.UserProfiles.UserProfileException: System.ServiceModel.Security.MessageSecurityException     at Microsoft.Office.Server.UserProfiles.MossClientBase`1.ExecuteOnChannel(String operationName, CodeBlock codeBlock)     at Microsoft.Office.Server.UserProfiles.ProfilePropertyServiceClient.ExecuteOnChannel(String operationName, CodeBlock codeBlock)     at Microsoft.Office.Server.UserProfiles.ProfilePropertyServiceClient.GetProfileProperties()     at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.RefreshProperties(Guid applicationID)     at Microsoft.Office.Server.Utilities.SPAsyncCache`2.GetValueNow(K key)     at Microsoft.Office.Server.Utilities.SPAsyncCache`2.GetValue(K key, Boolean asynchronous) at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.InitializePropertyCache()

Jul 20, 2011 at 9:19 PM

ok  - bit of an update - this doesn't sound right, but:

I get the issue repeatedly if I use the default name for AutoSPInstallerInput.xml, and make references to my servers inside that file. (provision=, start=, etc)

If I use that same file (with servers referenced inside the files), but renamed to be server specific - I don't see the issue.



Jul 21, 2011 at 9:34 AM

Hi Rob,

I've done a few builds this week and sometimes the Profile stuff works and other times it doesn't...

I don't see how rennaming the xml file can make a difference, but I'll certainly give it a try when I get chance & report back.



Jul 22, 2011 at 8:13 PM

I've done a load more builds, and I'm seeing the same as you Simon - the file renaming was just a coincidence I guess.

I'm beginning to wonder whether my VM setup is part of the problem, perhaps some timing / sync issues of some description, causing unpredictable outputs.

Sep 27, 2011 at 7:35 AM

Had the same issue. Waited for 4 hours for "Provisioning User Profile Sync Service, please wait" and checked Event Log to find errors Event ID 2159 errors.  Restarted IIS and hit enter on Powershell script and it continued.  :-)

I think it might be due to a security cert having expired.

Dec 6, 2011 at 3:12 PM

I changed a timeout value in AutoSPInstallerFunctions.ps1 and that solved the issue. Look for function CreateUserProfileServiceApplication (long one) and in this function for the following lines:

# Wait 2 minutes for either the UPS to be created, or the UAC prompt to time out
While (($UPSWaitTime -lt 120) -and ($ProfileServiceApp.Status -ne "Online"))

The problem is that 120 seconds (or two minutes) is not long enough, especially if you have, like me, a not so well performing environment with VMs. I changed the value to 600 (or five minutes):

# Wait 2 minutes for either the UPS to be created, or the UAC prompt to time out
While (($UPSWaitTime -lt 600) -and ($ProfileServiceApp.Status -ne "Online"))

Timeout values are a big nuisance and basically represent a race condition. There will always be a case where the environment is so slow that the timeout value is too small...

Dec 17, 2011 at 5:35 PM

This is one of those parts of the process where the 'gremlins' run the show :-) I literally just installed a test farm where the user profile sync was messed up (couldn't create default sync connection, either via script or manually), then rolled back the snapshots, tried again with very same script/input, and it went through fine... :-s


Jul 11, 2012 at 12:56 AM

@bml303 - I am very glad and grateful to you for posting this - it is a terrific solution to a common problem.... That being a less than optimally spec'd out server.  That said, I wanted to just offer a friendly FYI...

Setting it to "600" is going to actually be ten minutes.  If you want to limit it to five, you'll want to use the value "300".

Sep 12, 2012 at 7:13 AM

I have seen that issue also. The problem appears to be a timing issue between the CreateUPSAsAdmin call (which launches another window as the farm account) and the first call to '$ProfileServiceApp = Get-SPServiceApplication |?{$_.DisplayName -eq $UserProfileServiceName}'. This second call (by the setup account) appears to 'touch' the service and trigger the Update conflict error. To get around this issue, I add a Pause straight after the CreateUPSAsAdmin call.