Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Mass Deleting My Sites and Profiles based on OU

  Asked By: Chelsea    Date: Jun 01    Category: Sharepoint    Views: 1685

I need to MASS delete a large amount of my sites. I need to delete them based
on the following. All users that are within a specific OU in the root under the
domain name in AD need to have there my sites deleted and there profiles removed
from the profile database on sharepoint. I have an LDAP filter that excludes
any new users from being imported from this OU but I need to retrofit it for
users who were imported before the ldap filter.



7 Answers Found

Answer #1    Answered By: Cassidy Sharpe     Answered On: Jun 01

Custom code¦ never seen an app that works like that for you¦ not the best news¦ I admit.

Answer #2    Answered By: Peter Peterson     Answered On: Jun 01

Yeah were looking at a couple of different options for this now. Hey, maybe this could be marketable? I mean how do other people clean up there profile  databases and my site areas.

Answer #3    Answered By: Hans Weiss     Answered On: Jun 01

This is a very good question and i would love to hear how others deal with this

My view is that if sps uses active direcory and creates the profiles  for user
accounts that exist, why can it not REMOVE the profile  when it detects that the
ad user account has been deleted/removed?

This is very frustrating for us. The people search gives companies an online
employee directory to use which is great. But it is very very
embaassing/frustrating when users  point out all the ex-employees that have left
the company months ago yet they stil exist in the profile database.

A solution for this could not be that difficult to code or script. Why does it
not exist up to this point is the part i boggle the most.

Does moss clean up after itself or is it the same deal in the next ver also?

Answer #4    Answered By: Alison West     Answered On: Jun 01

Our AD import deltees users  from the profile  database when they don't show up in the import three times in a row. The problem is the user entries in the sites; i.e., /_layouts/[LCID]/siteusrs.aspx

Answer #5    Answered By: Freddy Heath     Answered On: Jun 01

DeliverPoint can help with centralized SharePoint permissions management
including removal from the User Info Gallery.

Answer #6    Answered By: Joanna Dixon     Answered On: Jun 01

I was told this was how the ldap  was written, but it does not seem to be working. Our profile  database has all the deleted users  showing up. Here is what the query looks like

(&(objectCategory=person) (objectClass=user)(!cn=_*)(!sAMAccountName=_*)(!displayName=_*)( !(userAccountControl:1.2.840.113556.1.4.803:=2)))

I don't know a whole lot about LDAP so if you have any suggestions, please let me know. Maybe this needs to be set somewhere else?

Answer #7    Answered By: Jaime Weaver     Answered On: Jun 01

OK heres what I have found. I have written a console app that
executes a SQL query against the profile  database. It looks in the
shared services portal's prof database  in the UserProfiles table. It
does a select on the following --> SELECT NTName, UserID FROM
UserProfile WHERE bDeleted = 1

It then plugs the result set into a data-reader and loops through
deleting user profiles  one by one using
UserProfileManager.RemoveUserProfile. This worked great for about
half of the profiles I needed to delete. However, the other half are
returning a "Could not find user with corresponding SID in the domain.
Check the spelling of the account name and try again." error. It
appears that this is because of either the account name was changed
when the AD account was deactivated or that the user was deleted  out
of AD. Any one have a suggestion on how to clean the rest of the
users out? I was thinking that maybe I could write a batch file to
use the stsadm.exe but I am getting this users  does not exist there as

Didn't find what you were looking for? Find more on Mass Deleting My Sites and Profiles based on OU Or get search suggestion and latest updates.