Changing SiteCollection Administrators Through Powershell

In a SharePoint 2013  environment, if you want to change the SharePoint Site Collection administrators, its easily achievable through PowerShell Commands.
 
$siteCollectionUrl = http://mySite/TestSite
$site =new-object Microsoft.SharePoint.SPSite($siteCollectionUrl)
$web = $site.RootWeb
$primaryAdministrator = $web.EnsureUser("domain\administrator")
$site.Owner = $primaryAdministrator;
$secondaryAdministrator = $web.EnsureUser("domain\secondaryadministrator")
$site.SecondaryContact = $secondaryAdministrator;
 
You can add as many additional accounts as you want to the SharePoint Site Collection administrators group, but only the primary and secondary site collection administrators will receive administrative alerts for the site collection. All members of the SharePoint Site Collection Administrators group have full administrative permissions to the site collection