Powershell command to manually create a user’s “My site” in SharePoint

Powershell command to manually create a “My site” in SharePoint:

The “My site” in SharePoint normally gets created by the instantiation process when a user tries to access his/her “My site” for the first time .Now this process depends on how you have configured this functionality to work in your environment. It could either be configured in a way such that the “My site” is already created for the users in the FARM or may be the users need to access their “My site” for the first time and then the instantiation process would run which will then create a “My site” for the user.

This can also be done manually using Powershell .

Mentioned below is the Powershell command which is used to manually create a user’s “My site” …

$site=Get-SPSite “https://my.sharepoint.com”
$serviceContext = Get-SPServiceContext -Site $site
$userProfileConfigManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
$testuser = $userProfileConfigManager.GetUserProfile(“domain\username”)
$testuser.PersonalSiteInstantiationState
$testuser.CreatePersonalSite()

Note: Please make sure that you’re logged into the SharePoint server using the FARM account while running this command .Also make sure that the account running this command has enough permissions in the user profile service application too. 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s