I wrote a simple script to run full deduplication. It is handy when you need one-time deduplication including garbage collection and scrubbing job.

$ErrorActionPreference = 'Stop'

Function Wait-RvDedupJob
{
    Write-Warning -Message 'Wait for all jobs to finish'
    while (Get-DedupJob -ErrorAction SilentlyContinue)
    {
        Start-Sleep -Seconds 10
    }
}

Get-DedupVolume | ForEach-Object -Process `
{
    $_.Volume

    Wait-RvDedupJob

    $_ | Start-DedupJob -Type Optimization -Priority Normal -Memory 50 -OutVariable job

    Wait-RvDedupJob

    $_ | Start-DedupJob -Type GarbageCollection -Priority Normal -Memory 50 -Full -OutVariable job

    Wait-RvDedupJob

    $_ | Start-DedupJob -Type Scrubbing -Priority Normal -Memory 50 -Full -OutVariable job

    Wait-RvDedupJob
}

Get-DedupStatus |
    Format-Table -Property Volume,
        @{ Expression = { $_.LastOptimizationTime }; Label = 'OptT' },
        @{ Expression = { $_.LastOptimizationResult }; Label = 'OptR' },
        @{ Expression = { $_.LastOptimizationResultMessage.Substring(0, 10) }; Label = 'OptRM' },
        @{ Expression = { $_.LastGarbageCollectionTime }; Label = 'ColT' },
        @{ Expression = { $_.LastGarbageCollectionResult }; Label = 'ColR' },
        @{ Expression = { $_.LastGarbageCollectionResultMessage.Substring(0, 10) }; Label = 'ColRM' },
        @{ Expression = { $_.LastScrubbingTime }; Label = 'ScrT' },
        @{ Expression = { $_.LastScrubbingResult }; Label = 'ScrR' },
        @{ Expression = { $_.LastScrubbingResultMessage.Substring(0, 10) }; Label = 'ScrRM' } -AutoSize
« Previous Next »