This script will allow you to create a personal site for a specific user in SharePoint 2010 or SharePoint 2013. It only needs 1 parameter: Loginname.
Save the script in C:\Temp and run:
. C:\Temp\Create-SPMySite.ps1 -username "domain\user"
param
(
[Parameter(Mandatory=$true)]
[string]$username
)
asnp *sh*
$mysite = (Get-SPSite)[0]
$context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
#Create user profile
$profile = $upm.ResolveProfile($username)
if(!$profile)
{
Write-Host "$profile does not have a profile. Can't create personal site"
}
elseif($profile)
{
if($profile.PersonalSite -eq $Null)
{
$profile.CreatePersonalSite()
Write-Host "Personal site created"
}
else
{
Write-Warning "$username already has a personal site"
}
}
Ref: https://gallery.technet.microsoft.com/Create-personal-for-4a70e4ad
Save the script in C:\Temp and run:
. C:\Temp\Create-SPMySite.ps1 -username "domain\user"
param
(
[Parameter(Mandatory=$true)]
[string]$username
)
asnp *sh*
$mysite = (Get-SPSite)[0]
$context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
#Create user profile
$profile = $upm.ResolveProfile($username)
if(!$profile)
{
Write-Host "$profile does not have a profile. Can't create personal site"
}
elseif($profile)
{
if($profile.PersonalSite -eq $Null)
{
$profile.CreatePersonalSite()
Write-Host "Personal site created"
}
else
{
Write-Warning "$username already has a personal site"
}
}
Ref: https://gallery.technet.microsoft.com/Create-personal-for-4a70e4ad
No comments:
Post a Comment