magritton
4/26/2017 - 3:02 PM

The script finds lists name who meet a specific criteria and recycles the list. This will gives a null because of the array initialization i

The script finds lists name who meet a specific criteria and recycles the list. This will gives a null because of the array initialization issues but still works

$TopSiteUrl = 'https://xxx'
$topSite = Get-SPWeb $TopSiteUrl
$ls = @()

foreach($list in $topSite.Lists)
{
	$l = $list | ?{$_.Title -like "*/*" -and $_.Title -like "*Request*"}
	#$l.Delete()
	$ls += $l.Title
}
foreach($l in $ls)
{
	$topSite.Lists[$l].Recycle()
}