TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
valmikeshwar reddy
NA
66
6.2k
PowerShell script to find and remove duplicate items from do
Sep 2 2014 4:50 AM
Hi Friends,
Please check this below script, It is finding the duplicate items and removing it. This script is not working to find the duplicate items from document library and remove. Can you please let me know where it is wrong.
Add-PSSnapin microsoft.sharepoint.powershell
$web = Get-SPWeb -Identity "http://zapltvsspdev02:4333/bu/EXCO"
$list = $web.Lists["AECI Documents"]
$AllDuplicates = $list.Items.GetDataTable() | Group-Object INumber | where {$_.count -gt 1}
$count = 1
$max = $AllDuplicates.Count
foreach($duplicate in $AllDuplicates)
{
$duplicate.group | Select-Object -Skip 1 | % {$list.GetItemById($_.ID).Delete()}
Write-Progress -PercentComplete ($count / $max * 100) -Activity "$count duplicates removed" -Status "In Progress"
$count++
}
Remove-PsSnapin Microsoft.SharePoint.PowerShell
Note:
In the above code, duplicates are found using the "INumber" column.
Reply
Answers (
1
)
Calculated Column in Sharepoint Error
User Permissions