# Enter the site URL instead http://sathiya.io
$weburl = "http://sathiya.io"
$site = new-object Microsoft.SharePoint.SPSite ($weburl)
$web = $site.OpenWeb()
Write-Host "The Web application is : "$web.Title
# Enter name of the List below insted of ProjectList
$oList = $web.Lists["ProjectList"];
$collListItems = $oList.Items;
$count = $collListItems.Count - 1
$itemCount = $contents.Count;
$currentItem = 1;
Write-Output -NoNewline "Are you sure you want to permanently delete the '$oList.ItemCount' item from the list '$oList.Title' (y/n)? " -NoNewline;
$con = Read-Host;
if ($con -eq "y") {
for($intIndex = $count; $intIndex -gt -1; $intIndex--)
{
#Deleting the item from list
"Deleting record: " + $intIndex
$collListItems.Delete($intIndex);
}
Write-Host $itemCount "item has been deleted from the list '"$oList.Title "'...!" -ForegroundColor Yellow;
}
else {
Write-Host "No changes are happened in the list'"$oList.Title "'...!" -ForegroundColor Black -BackgroundColor Green;
}
#Close the connection
$web.Dispose()