We're considering pre-provisioning each user's MySite in SP 2010 - I know MS don't recommend it but it's a Uni installation and we'd like to have the student accounts set up in advance rather than have everything go bananas when a few thousand people all turn up on the same day and start having a look around our available services.

Can this be done via a script of some sort? I presume Powershell has some mechanism to trigger the creation without the user having to physically visit their site?


This should get you started - you'll need to wrap the site creation part in a loop over your user list and possibly add some more error checking.

I know for sure this works in 2007 but haven't tested it in 2010. All the same stuff exists so it should. One final thing - this is SLOW - creating 1 user on my SP2007 server takes 5-10 seconds. If your mysites farm is beefy enough, you might actually be better off letting the users create their personal sites ad-hoc.


$siteurl = "http://your.mysitesurl.com"    

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

# start loop here
$user = "domain\username"
if ($upm.UserExists($user)) {
    $profile = $upm.GetUserProfile($user)

    # there are other exceptions you can catch, check out the UserProfiles class
    trap [Microsoft.Office.Server.UserProfiles.PersonalSiteExistsException] {
            Write-Host "personal site already exists for $user"
}  else {
  Write-Host: "user $user did not exist"
# end loop here

  • Thanks this is great. I expect the creation to be slow but we have the benefit of a window in the summer when we can set up any new students before they arrive by running this over a few nights if we need to. You've been a big help on this and most of my SharePoint questions! – Chris W May 26 '10 at 18:45
  • @Chris, Did this work? – trgraglia Apr 1 '11 at 8:30
  • Didn't end up using it - the rollout ended up being phased enough that we didn't need to worry about too many people all hitting it at once. – Chris W Apr 1 '11 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.