Quantcast
Channel: 2Pint Software
Viewing all articles
Browse latest Browse all 60

Use Powershell to DeDupe everything on a volume right now!

$
0
0

2Pint Software

Another Friday QuickScript..

We’ve been testing BranchCache with DeDupe a LOT over the last couple of weeks, and if you absolutely, positively got to dedupe every mother!*?$%£&  file in the room…accept no substitutes!

I think I ‘borrowed’ various bits of this from here and there..so thanks to those out there who were less lazy than me and actually wrote this shit from scratch!

Basically this script will run all 3 DeDupe jobs that you need on the volume, set the MinimumFileAgeDays to 0 so that you will get ALL files deduped, and will then monitor it all so that you can see when it’s done..

Here’s the PS

$dedupVolume = "E:"

Set-DedupVolume -Volume $dedupVolume -MinimumFileAgeDays 0

Write-Output "Starting Dedup Jobs..."
$j = Start-DedupJob -Type Optimization -Volume $dedupVolume
$j = Start-DedupJob -Type GarbageCollection -Volume $dedupVolume
$j = Start-DedupJob -Type Scrubbing -Volume $dedupVolume

do 
{
    Write-Output "Them Dedup jobs is running.  Status:"
    $state = Get-DedupJob | Sort-Object StartTime -Descending 
    $state | ft
    if ($state -eq $null) {Write-Output "Completing, please wait..."}
    sleep -s 5
} while ($state -ne $null)

#cls
Write-Output "Done DeDuping"
Get-DedupStatus | fl *

Run it, and you should get a nice job status every 5 secs like this..

dedupjobsrunning

 

Followed by a little summary of just how awesome the DeDupe results are

dedupesummary

 

So there we go. Obviously this is for testing purposes so I would recommend running this on yer main Hyper-V box or anything..

Cheers!

Phil 2Pint

The post Use Powershell to DeDupe everything on a volume right now! appeared first on 2Pint Software.


Viewing all articles
Browse latest Browse all 60

Trending Articles