Skip to content

Instantly share code, notes, and snippets.

@Mehmet-Erkan
Created March 20, 2018 15:24
Show Gist options
  • Save Mehmet-Erkan/2c78caea1ad09b79040ba0ba9797aaca to your computer and use it in GitHub Desktop.
Save Mehmet-Erkan/2c78caea1ad09b79040ba0ba9797aaca to your computer and use it in GitHub Desktop.
SharePoint compare list values with PowerShell
$mSite = Get-SPweb "http://sharepointed.com/site/taco"
$aList = $mSite.lists["A"]
$bList = $mSite.lists["B"]
$arrA = @()
$arrB = @()
foreach($iA in $aList.Items)
{
$arrA += $iA["Title"]
}
foreach($iB in $bList.Items)
{
$arrB += $iB["Title"]
}
$c = Compare-Object -ReferenceObject $arrA -DifferenceObject $arrB -PassThru
Write-Host $c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment