Script to clear User Information List

A simple SharePoint PowerShell script to clear the user information list, just keep in mind that doing so, you will lose all users credentials previously set.

$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
}
$web.dispose()

One response to “Script to clear User Information List”

  1. Alearner Avatar
    Alearner

    can you do that using jquery or rest api

Leave a reply to Alearner Cancel reply