0

I want to remove a user from SharePoint from all Web applications in SharePoint Farm. Like the user has never existed! is ti possible? I see there many users that don't exists in AD anymore. But I still see them into SharePoint.

other thing: how will Sp Manage this situation? When it will find a Document created by a User that will disappear from SharePoint ?

2 Answers 2

0

Couple of things.

Funcations:

 Function RemoveUser($LoginName,$SiteUrl) { #Get site $Site = Get-SPSite | where {$_.url -eq $SiteUrl} If($Site) { $Web = $Site.openweb() Try { #Get user $user = $web.SiteUsers | where {$_.UserLogin -like "*$LoginName"} #Remove user if($user) { $web.SiteUsers.Remove($user) write-host "Remove user $LoginName from site '$SiteUrl' successfully." } Else { write-Warning "User $LoginName not found on site '$SiteUrl'." } } Catch { Write-Error $_ } } } 

then run the command like this:

 RemoveuserFromwebapplication.ps1 -LoginName "user1" -SiteUrl "http://win-chu4c2rckti:8080/sites/project" 

How to remove certain user from a SharePoint site (PowerShell)

  • When a user removed from SharePoint and all the documents or items created or modified by it, assign to system account.
0

To delete a user in SharePoint 2010, Navigate to the site collection as a Site Collection Administrator. Click on Site actions >> Site permissions. Select the user you want to delete, and click on Actions >> “Delete user from Site collection”

Hope This Works, Peter

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.