Requirement

Undeclare all records in a SharePoint list. Declare all records in a SharePoint list. Declare only specific records in a SharePoint list.

Solution

Use the following PowerShell script.

$SPAssignment = Start-SPAssignment
$web = Get-SPWeb <a href="http://your-site">http://your-site</a> -AssignmentCollection $spAssignment
$list = $web.lists["your-list"].items
foreach ($item in $list)
{
	$IsRecord = [Microsoft.Office.RecordsManagement.RecordsRepository.Records]::IsRecord($Item)
	if ($IsRecord -eq $true){
		Write-Host "Undeclared $($item.Title)"
		[Microsoft.Office.RecordsManagement.RecordsRepository.Records]::UndeclareItemAsRecord($Item)
	}
}
Stop-SPAssignment $SPAssignment

To declare all items as a record, change the relevant code above to the following:

	if ($IsRecord -ne $true){
		Write-Host "Declared $($item.Title)"
		[Microsoft.Office.RecordsManagement.RecordsRepository.Records]::DeclareItemAsRecord

To declare specific items as a record, based on a condition

	$IsRecord = [Microsoft.Office.RecordsManagement.RecordsRepository.Records]::IsRecord($Item)
	if ($IsRecord -ne $true){
		if ($item["Status"] -eq "Completed")
		{ 
			Write-Host "Declared $($item.Title)"
			[Microsoft.Office.RecordsManagement.RecordsRepository.Records]::DeclareItemAsRecord($Item)
		}
	}

This will declare as record only items that have ‘Status’ equal to Completed.