After a while the message in the other window changes to an error (after I already pressed the any key and the main script continued)

New-SPProfileServiceApplication : An update conflict has occurred, and you must re-try this action. The object UserProfileApplication Name=User Profile Service Application was updated by DOMAIN\spsetup, in the powershell (372) process, on machine
RUMBA. View the tracing log for more information about the conflict.At C:\Users\spsetup\AppData\Local\Temp\1\AutoSPInstaller-ScriptBlock.ps1:3 char:56

After the script fails on UPS I can see that SyncDB and SocialDB have been created by spfarm and spservices is a db_owner. ProfileDB is also created by spfarm but their both spservices and spsetup are db_owner, where spsetup is also ShellAdmin.

I have SQL server alias to a SQL instance on a non standard port. This works fine for the who process but for the UPS the following errors appear in the logs.

Cannot connect to SQL Server. SQLUAALIAS not found. Additional error information from SQL Server is included below. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Last thing : When the installation completes with above errors I can go to CA, delete the Service Application, create a new one, takes 5-7 minutes (!). Then start the UPS service and Sync service.

This works - key here is that in CA I do this under spsetup as well and of course provide the farm user/password for starting. Or it is a timeout that is the problem or credentials under which the script runs.. I dont know...

I'm pretty certain it's nothing to do with either the UNC path (I always run via UNC path) or non-standard SQL port in alias (that's what an alias is for after all). Also I thought I'd resolved all the issues with granting rights to profile DBs
etc. The Farm Account is actually the one who creates those databases anyhow so it should always be dbo and the other accounts get added afterwards...

Not sure what to suggest except to check your account mapping/config in the xml file?

UPDATE : one single VM script now succesful. With a little hickup on Search which was probably because of old index files still being present in Microsoft Office Servers\14 folder, the script ran smoothly.

I use a named instance on a alternative port and used SQL configutation manager to set that on both protocols for my instance and also as default port on both options of the native client. I added both the setup and the farm admin account to SQL wit secadmin
and dbcreator roles.

I have an inbound rule on SQL for the specific port, no outbound rule though on the WFE. This does not seem to matter because all connections work, except upon creation of the UPS.