In my previous 2 posts on Host Named Site Collections, I laid out the powershell scripts to create Host Name site collections as well as creating managed paths under them.
After that, these site collections can be handled using PowerShell scripts normally.
In case of needing to migrate path-based site collections to host-named site collections, you can simply backup the path-based site collection & restore it to the newly created host named site collection.
A sample script for such backup & restore operation is as follows:
$hostHeaderWebApp = “http://<WebAppName>:<WebAppPort>”
$firstHostNamedSiteCollection = “<URL of Host Name Site Collection>”
$OriginalSiteCollection = “<URL of Path Based Site Collection>”
$BackupPath = “c:\temp\TestSiteBackup.bak”
Backup-SPSite $OriginalSiteCollection -Path $BackupPath
Restore-SPSite -Identity $firstHostNamedSiteCollection -Path $BackupPath -HostHeader $hostHeaderWebApp -Force