Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've been asked to create a solution which detects the dead accounts and cleans it up from a SharePoint site.

I found a code snippet here (in the comments) which checks each user against the AD and cleans up the account. But the LDAP details are hardcoded in the code. What happens if i want to detect it dynamically and check the dead accounts? Is there a more elegant solution to do this?

Any ideas?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Of course, the LDAP details should be a parameter.

As the linked example is a Windows forms app, this could be a text box on the form. If it was a command-line app, then a command line argument.

I'm not sure what you're looking for in terms of elegance. If you want the app to work out which Active Directory domain it's running within without needing to specify a parameter, then a better place for this question is Stack Overflow. However that will restrict you from being able to search certain parts of AD for these accounts.

share|improve this answer

Generally, there are two reasons why obsolete users or groups can exist in the SharePoint Server 2010 user profile store:

-Obsolete users: The My Site cleanup timer job is not active. The User Profile Synchronization timer job marks for deletion users who have been deleted from the directory source. When the My Site cleanup job runs, it looks for all users marked for deletion and deletes their profiles. Respective My Sites are then assigned to the manager for the deleted user and an e-mail message notifies the manager of this deletion.

-Obsolete users and groups: Users and groups that were not imported by Profile Synchronization exist in the user profile store. This can occur, for example, if you upgraded from an earlier version of SharePoint Server and chose to only synchronize a subset of domains with SharePoint Server 2010.

Here is how you would do it in PowerShell: http://iedaddy.com/2012/02/sharepoint-2010user-information-lists-and-user-profile-cleanup/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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