Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Programmatically delete users from all site collections

Programmatically delete users from all site collections

Scheduled Pinned Locked Moved SharePoint
sharepointhelp
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 3085185
    wrote on last edited by
    #1

    Please guys, I need a help on the code that programmatically deletes outgoing SharePoint users from all site collections in SharePoint 2010. Thank you all..

    beluomo

    R 1 Reply Last reply
    0
    • M Member 3085185

      Please guys, I need a help on the code that programmatically deletes outgoing SharePoint users from all site collections in SharePoint 2010. Thank you all..

      beluomo

      R Offline
      R Offline
      Rsharepoint
      wrote on last edited by
      #2

      You can achieve this using the PowerShell script , like as bellow. hope it will help you $LoginName = "domain\login" $siteURL = "http://SharePointSiteURL" #URL to any site in the web application. Clear-Host $siteCount = 0 [system.reflection.assembly]::loadwithpartialname("Microsoft.SharePoint") $site = new-object microsoft.sharepoint.spsite($siteURL) $webApp = $site.webapplication $allSites = $webApp.sites foreach ($site in $allSites) { $web = $site.openweb() $web.SiteUsers.Remove($LoginName) $web.Dispose() $siteCount++ } $site.dispose() write-host "Updated" $siteCount "Site Collections."

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups