Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 4 down vote accepted

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 = ""    

$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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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