Wednesday, January 9, 2013

Delete SharePoint List using PowerShell

In this post we will discuss how we can delete a SharePoint list using PowerShell.

You can also check my PowerShell articles on Get System Accounts using PowerShell, Backup and Restore site collection using PowerShell, Switch from classic to claims authentication in SharePoint 2010.

Below is the code to delete a SharePoint list using PowerShell.
$siteURL="http://Site URL"

 $listName="ListName"

 $web=Get-SPWeb $siteURL $list=$web.Lists[$listName]

 if($list -ne $null)
{

 $list.Delete();

 }

The above code will delete the List.

No comments:

Post a Comment