$adGroup = "" # AD Group with MySite users$siteURL = "" # any local SharePoint Site will do$members = Get-ADGroupMember -Identity $adgroup -Recursive | sort name# get UserProfileManager$serviceContext = Get-SPServiceContext -site $siteURL -ErrorAction Stop$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) -ErrorAction Stopforeach ($member in $members){if ($upm.UserExists($member.SamAccountName)){ $profile = $upm.GetUserProfile($member.SamAccountName) $perssite = $profile.PersonalSite if ($perssite -eq $null) { # either this $profile.CreatePersonalSite(1031) # should work in most cases # or this # $profile.CreatePersonalSiteEnque($true) # will work in all cases; gets language from mysite host $perssite = $profile.PersonalSite if ($perssite -eq $null) { # do some error handling } }}}