The user profile service application provision does not work when a host named site collection is used for the mysite host.
First, the code for Create MySites Web Application and Create MySites Site Collection must be commented out in the function CreateUserProfileServiceApplication as this code will only create a path based site collection. Alternatively the MySite Host can be created during the web application provisioning if its included in the site collections list.
The second issue is the site URL is not detected properly as the script uses the following logic to determine the mysite URL:
$mySiteWebApp = $xmlinput.Configuration.WebApplications.WebApplication | Where {$_.type -eq "MySiteHost"}
$mySiteURL = $mySiteWebApp.url
$mySitePort = $mySiteWebApp.port
This URL is the host name site collection URL not the MySite URL.
First, the code for Create MySites Web Application and Create MySites Site Collection must be commented out in the function CreateUserProfileServiceApplication as this code will only create a path based site collection. Alternatively the MySite Host can be created during the web application provisioning if its included in the site collections list.
The second issue is the site URL is not detected properly as the script uses the following logic to determine the mysite URL:
$mySiteWebApp = $xmlinput.Configuration.WebApplications.WebApplication | Where {$_.type -eq "MySiteHost"}
$mySiteURL = $mySiteWebApp.url
$mySitePort = $mySiteWebApp.port
This URL is the host name site collection URL not the MySite URL.