If you are doing the SharePoint migration, then it is one of the most important report which can help you to verify the migrated lists and item count in two sites. To minimize that effort, I have written a PowerShell script which can compare two separate sites and show all the migrated lists and item count.

To make it easier for end user, I created a function CompareListsandItemCount, which take Source site URL and Destination Site URL as parameter. I did this job for migrating content with same tenant, so I used a single user account. If you are migrating content to separate office 365 site, then you need call the Get-Credential function for destination site separately for destination context. I used the credentials of both source and destination lists.

 

PowerShell
Edit|Remove
    Cred= Get-Credential$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) 
 
    $ctxSource = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrlSource)  
    $ctxSource.Credentials = $credentials$ctxDestination = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrlDestination)  
    $ctxDestination.Credentials = $credentials

Now, you need to call the function CompareListsandItemCount and pass the source and destination site URLs as parameters and execute the function.

PowerShell
Edit|Remove
CompareListsandItemCount "https://MsTalk.sharepoint.com/MsTechTalkSource" "https://MsTalk.sharepoint.com/sites/MsTechTalkDestination" | Out-GridView 
 

Or export output as csv file where you can have the excel view.

PowerShell
Edit|Remove
CompareListsandItemCount "https://MsTalk.sharepoint.com/MsTechTalkSource" "https://MsTalk.sharepoint.com/sites/MsTechTalkDestination"  | | ExportCsv -Path "C:\CompareListsandItemCount.csv"
Below screen shot showing the required output where you can see all the migrated lists and item count. This will help you to make sure that you have migrated all the content properly.