Creating Personal Sites for Multiple Users present in UPA

I was recently working on this case where I had to create multiple personal sites for users within the UPA application.
I got few articles which helped but did not provide me with the correct script.

A loud shout to my colleague Chanchal on assisting me which eventually helped us with the following PS script that would help us all create personal sites for all the users present in your UPA application.
Since most of us face situations where we need multiple personal sites in your farm during research, i have published this post to assist others as well. I hope this helps all.

Add-PSSnapin microsoft.sharepoint.powershell
[Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")

$mysiteHostUrl = "https://hulk/my/"
$personalSiteGlobalAdmin = "shptgeek\sharepoint"
$personalSiteGlobalAdminNot ="sharepoint@shptgeek.local"
$personalSiteGlobalAdminDisplayName = "Personel Site admin"
$mysite = Get-SPSite $mysiteHostUrl

$context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)

$AllProfilesCount = $upm.Count

for($i = 1; $i -lt $AllProfilesCount; $i++)
{
$profile = $upm.GetUserProfile($i)

$DisplayName = $profile.DisplayName
$AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value

$DisplayName
if(!$profile.PersonalSite )
{
write-host "Personal site does not exist for: " $DisplayName
 $profile.CreatePersonalSite()
               #Adding an extra admin for personel sites               
               $pweb = $profile.PersonalSite.OpenWeb()
               $pweb.AllUsers.Add($personalSiteGlobalAdmin,$personalSiteGlobalAdminNot,$personalSiteGlobalAdminDisplayName,$null);
               $padm= $pweb.AllUsers[$personalSiteGlobalAdmin];
               $padm.IsSiteAdmin = $true;
               $padm.Update();
               $pweb.Dispose();
               write-host "Personal Site Admin has assigned"
}
else
{
write-host "Personal site exists for " $DisplayName
}
}        
$mysite.Dispose();