Ads

Wednesday, 22 May 2013

reate a mysite for each SharePoint profile

So we have spent an amount of time (hopefully not too much ha) configuring the User profile service and the synchronisation which imports profiles from AD. Our filters are in place so we only have valid profiles.

For the next step we would like to automatically create all the mysites in one hit.

This may or may not be a good idea depending on your exact business requirements but if it is what you want here is a script which will iterate through the profiles and create you a my site for each user.

$site = new-object Microsoft.SharePoint.SPSite("http://mysitehost"); 
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site); 


$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext); 
$AllProfiles = $ProfileManager.GetEnumerator();


foreach($profile in $AllProfiles) 
  
     $profile.CreatePersonalSite();
}


Great fun don't you reckon.

No comments:

Post a Comment

Ads