Force migrate SP13 MySites Document Libraries

Here is a quick PS script go through a MySite Web Application and migrate a user's SP10 "Shared Documents" & Personal Documents" to the SP13 "Documents" document library.

For SP13, they decided to combined the two "Shared & Personal" into one "Documents" with a "Shared with Everyone" folder in it. When someone comes to your MySite, they can only see the stuff in the "Shared with Everyone" folder, unless you have changed the permissions for the DocLib.

The script will also write to an file "$outfile" the names of any MySite Site Collections that did not migrate cleanly. This may be due to various reasons, such as the "Documents" DocLib wasn't empty, one of the SP10 DocLibs were missing, etc

This would especially be good to run right after a migration, instead of hoping everyone would select the "One Library is all you need" on the pop-up the first time they go to their MySite in SP13 right after migration.

Modify the "$outfile" variable to where you want the file to be written to.

Also, run this as a system account, unless you want your name plastered throughout everyone's "Modified By" in the "Documents" Doclib and them wondering why you were in there...

---

#run this as a system account

Add-pssnapin Microsoft.SharePoint.PowerShell - ErrorAction SilentlyContinue

$outfile = "c:\move-docs.txt"

$mysites = get-spsite -webapplication "<MySite Web Application>" -limit all
foreach ($site in $mysites){
    $web = get-spweb $site.url
    $result = [Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentMoveUtility]::FirstRunDocumentMove($web).ToString()
    if ($result -eq "False")
        {"$result $site" | Out-file $outfile -encoding string]
    else
        { [Microsoft.SharePoint.Portal.UserProfiles.MySiteDocumentMoveUtility]::FirstRunDocumentMove($web)}
}

---

#Use this to turn off the MySites First Run Experience

 $web = get-SPWeb https://mysiteurl
$web.Properties[“urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-O15FirstRunExperience”]=”OFF” 
$web.Update()