Powershell script to clean the User Information List in SharePoint 2010


Remove all users from a SharePoint site, including all entries in the User Information List which can be located at:



#This script will delete all users in the User Information List. Change $url to your site/site collection.

$url = “http://sitecollection”
$web = get-spweb $url
$list = $web.Lists[“User Information List”]
$listItems = $list.Items
$listItemsTotal = $listItems.Count
for ($x=$listItemsTotal-1;$x -ge 0; $x–)
Write-Host(“DELETED: ” + $listItems[$x].name)
remove-spuser $listItems[$x][“Account”] -web $url -confirm:$false

Tags: ,

2 Responses to “Powershell script to clean the User Information List in SharePoint 2010”

  1. Dirk Loehn February 23, 2012 at 3:58 am #

    Thanks Andrew,
    You’re missing a ‘-‘ in line
    for ($x=$listItemsTotal-1;$x -ge 0; $x–)
    -> should be
    for ($x=$listItemsTotal-1;$x -ge 0; $x-–)

    Apart from that, great help, thanks – Dirk

  2. friv 337 September 29, 2016 at 3:33 am #

    Very good blog you have here but I was curious if you knew
    of any community forums that cover the same topics talked about here?

    I’d really love to be a part off community where I can get advice from other experienced people
    that share the same interest. If you have any recommendations, please let me know.

    Bless you!

Leave a Reply

%d bloggers like this: