Created
November 21, 2013 19:24
-
-
Save mikekunze/7587946 to your computer and use it in GitHub Desktop.
This is a basic script that loads the powershell cmdlets for SharePoint and then creates a MySite if not exist for the user defined in $user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) { | |
Add-PSSnapin Microsoft.SharePoint.PowerShell | |
} | |
$user = "mkunze" | |
$site = get-spsite("https://domain.com/mysites") | |
$context = [Microsoft.Office.Server.ServerContext]::GetContext($site) | |
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) | |
$profile = $upm.GetUserProfile($user) | |
if($profile.PersonalSite -eq $Null) { | |
$DisplayName = $profile.DisplayName | |
write-host "Creating personal site for $DisplayName, it doesnt exist yet" | |
$profile.CreatePersonalSite() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment