Microsoft Windows Deduplication: Exclude folders retroactively

Posted 2015-12-03 18:47 by Traesk. Edited 2016-03-31 23:46 by Traesk. 2133 views.

Issue: If you exclude folders from Deduplication using
Set-DedupVolume z: -ExcludeFolder "Z:\Folder1", "Z:\Folder2" described on TechNet, it will not "unoptimise"/expand the files already deduped in this folder. It will only prevent new files from being optimised. This is not made clear by Microsoft.

Solution: You have to use the
Expand-DedupFile -Path "Z:\Folder1\file"
for every file you need to unoptimise. As there are only commands to unoptimise single files and whole volumes, the simplest solution is to get all files in these folders and pipe it to Expand-DedupFile like this:
Get-ChildItem "Z:\Folder1", "Z:\Folder2" -File -Recurse | select FullName | ForEach-Object {Expand-DedupFile -Path $_.FullName}
This will unoptimise all files in the specified folders. It will be rather slow, and you will get an error-message for every file that is not optimised, but it works well.

2019-02-13 22:22 by Peter
Creating a Copy of the two folders and delete the original ones should be a bit faster.
2022-06-29 00:26 by Mike
Super useful, thank you!!