0

I am using sp 2010. I have some users which are not any more working for our company. We would like to first check if they have a mysite. If they have a mysite I would like to lock it. After this I would like to remove this user from the user profile service application. How could I do this last action?

$url = "http://mysite.myCompany.net/personal/MDNI"
Set-SPSite -Identity $url -LockState "NoAccess"
#Here I would like to remove the user "myDomain\MDNI" from the user profile service application.
1

1 Answer 1

0

Practically in the real case scenario, setting up the My Site by removing the access of the respective user is enough. If there's a need to backup the site, then do it before removing or locking the site. For the User Profile's side, we need to keep My Site Cleanup job running properly. Although the name is My Site Cleanup job, it does everything, from removing User Profile, till removing My Site.

There's a good article from one of my favourite SharePoint enthusiast, Spencer Harbar, about User Profile Deletion.

Basically My Site will do these:

  1. Removing User Profiles that are marked for deletion
  2. Delete the User Profiles' My Site that are marked for deletion directly, if there's no manager assigned to his/her Active Directory's Manager attribute (generally this will be treated as that person's direct manager.
  3. If the user has Manager attribute set, it will assign his/her direct manager as secondary contact, and notify direct manager that the My Site will be deleted in 14 days.
  4. Email the direct manager again after 11 days (3 days before deletion), that My Site will be deleted.
  5. Total deletion on the 14th days.

There's requirement to let My Site Cleanup job to work properly. It requires My Site Host to be configured. If it is not configured, then the job which includes deletion of User Profile will not work.

System will trigger and set an account marked for deletion if you do one of these:

  1. Account is deleted
  2. Account is disabled
  3. SharePoint User Profile connection is changed with additional filter or recreated
  4. Account is moved out that is out of OU, and OU is not part of SharePoint User Profile sync

That is why we don't need to do additional jobs, as long as we have the SharePoint configured properly. Basically this timer job will run arround 59 minutes (by default). You can change the amount of time or directly run the timer job.

http://www.harbar.net/archive/2011/02/10/account-deletion-and-sharepoint-2010-user-profile-synchronization.aspx

http://blogs.msdn.com/b/kaevans/archive/2012/06/25/top-recommendations-for-managing-the-my-site-cleanup-timer-job.aspx

2
  • Why is it anough to lock only the mysite? I would like to remove also the user from the user profile service application. In AD this user is disabled. I would like to have a clean UPS with only users which are working for this company.
    – Ola
    Oct 2, 2014 at 8:18
  • Please check the edited answer above. Oct 2, 2014 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.